mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-43857: Improve the AttributeError message when deleting a missing attribute (#25424)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
43b135f94e
commit
a95138b2c5
4 changed files with 62 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue