Skip to content

Commit d9ceb27

Browse files
committed
Merge remote-tracking branch 'sobolevn/issue-130425' into delattr-suggestions-combined
This merges the delattr suggestion feature implementation by @sobolevn from PR #130427 with added tests from PR #130455.
2 parents 321bf59 + 818decc commit d9ceb27

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: 'attr'?"`` 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
@@ -6898,6 +6898,7 @@ store_instance_attr_lock_held(PyObject *obj, PyDictValues *values,
68986898
PyErr_Format(PyExc_AttributeError,
68996899
"'%.100s' object has no attribute '%U'",
69006900
Py_TYPE(obj)->tp_name, name);
6901+
_PyObject_SetAttributeErrorContext(obj, name);
69016902
return -1;
69026903
}
69036904

0 commit comments

Comments
 (0)