diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2022-03-05 13:59:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-05 13:59:24 (GMT) |
commit | ab9301a28fa431d7a32163126fc96de3b2ce6107 (patch) | |
tree | 940f6d0813671a006052b334e0f836e61f97a78e /Objects/abstract.c | |
parent | 2031149b9a7dfab5f5bad63f417e19f4fc2b9661 (diff) | |
download | cpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.zip cpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.tar.gz cpython-ab9301a28fa431d7a32163126fc96de3b2ce6107.tar.bz2 |
bpo-46927: Include the type's name in the error message for subscripting non-generic types (GH-31694)
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 6ad66a8..79f5a5f 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -190,6 +190,9 @@ PyObject_GetItem(PyObject *o, PyObject *key) Py_DECREF(meth); return result; } + PyErr_Format(PyExc_TypeError, "type '%.200s' is not subscriptable", + ((PyTypeObject *)o)->tp_name); + return NULL; } return type_error("'%.200s' object is not subscriptable", o); |