Skip to content

Commit ee4081f

Browse files
sobolevnPranjal095
authored andcommitted
pythongh-130425: Add "Did you mean" suggestion for del obj.attr
1 parent 5e1e21d commit ee4081f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add ``"Did you mean"`` suggestion when using ``del obj.attr`` if ``attr``
2+
does not exist.

Objects/dictobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6939,6 +6939,7 @@ store_instance_attr_lock_held(PyObject *obj, PyDictValues *values,
69396939
PyErr_Format(PyExc_AttributeError,
69406940
"'%.100s' object has no attribute '%U'",
69416941
Py_TYPE(obj)->tp_name, name);
6942+
_PyObject_SetAttributeErrorContext(obj, name);
69426943
return -1;
69436944
}
69446945

0 commit comments

Comments
 (0)