diff options
author | Géry Ogam <gery.ogam@gmail.com> | 2022-05-05 13:37:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 13:37:26 (GMT) |
commit | a95138b2c5a3ba3d9a1a635566e22e5843b6a45c (patch) | |
tree | 9df22636e46deb06e0c8897ed0d072c440c42a7b /Objects/dictobject.c | |
parent | 43b135f94ebf3e6e84ddb0f75ed8510b96a610e4 (diff) | |
download | cpython-a95138b2c5a3ba3d9a1a635566e22e5843b6a45c.zip cpython-a95138b2c5a3ba3d9a1a635566e22e5843b6a45c.tar.gz cpython-a95138b2c5a3ba3d9a1a635566e22e5843b6a45c.tar.bz2 |
bpo-43857: Improve the AttributeError message when deleting a missing attribute (#25424)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Objects/dictobject.c')
-rw-r--r-- | Objects/dictobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 063fd24..ebbd22e 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -5472,7 +5472,9 @@ _PyObject_StoreInstanceAttribute(PyObject *obj, PyDictValues *values, values->values[ix] = value; if (old_value == NULL) { if (value == NULL) { - PyErr_SetObject(PyExc_AttributeError, name); + PyErr_Format(PyExc_AttributeError, + "'%.100s' object has no attribute '%U'", + Py_TYPE(obj)->tp_name, name); return -1; } _PyDictValues_AddToInsertionOrder(values, ix); |