summaryrefslogtreecommitdiffstats
path: root/Objects/dictobject.c
diff options
context:
space:
mode:
authorGéry Ogam <gery.ogam@gmail.com>2022-05-05 13:37:26 (GMT)
committerGitHub <noreply@github.com>2022-05-05 13:37:26 (GMT)
commita95138b2c5a3ba3d9a1a635566e22e5843b6a45c (patch)
tree9df22636e46deb06e0c8897ed0d072c440c42a7b /Objects/dictobject.c
parent43b135f94ebf3e6e84ddb0f75ed8510b96a610e4 (diff)
downloadcpython-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.c4
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);