Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 056e265

Browse files
committed
Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__
1 parent 6c6596e commit 056e265

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

Lib/test/test_inspect.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,6 +1764,11 @@ class ThisWorksNow:
17641764
__call__ = type
17651765
test_callable(ThisWorksNow())
17661766

1767+
# Regression test for issue #20786
1768+
test_unbound_method(dict.__delitem__)
1769+
test_unbound_method(property.__delete__)
1770+
1771+
17671772
@cpython_only
17681773
@unittest.skipIf(MISSING_C_DOCSTRINGS,
17691774
"Signature information for builtins requires docstrings")

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Core and Builtins
1414
- Issue #20637: Key-sharing now also works for instance dictionaries of
1515
subclasses. Patch by Peter Ingebretson.
1616

17+
- Issue #20786: Fix signatures for dict.__delitem__ and
18+
property.__delete__ builtins.
19+
1720
Library
1821
-------
1922

Objects/typeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6192,7 +6192,7 @@ static slotdef slotdefs[] = {
61926192
"__set__($self, instance, value, /)\n--\n\nSet an attribute of instance to value."),
61936193
TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set,
61946194
wrap_descr_delete,
6195-
"__delete__(instance, /)\n--\n\nDelete an attribute of instance."),
6195+
"__delete__($self, instance, /)\n--\n\nDelete an attribute of instance."),
61966196
FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init,
61976197
"__init__($self, /, *args, **kwargs)\n--\n\n"
61986198
"Initialize self. See help(type(self)) for accurate signature.",
@@ -6289,7 +6289,7 @@ static slotdef slotdefs[] = {
62896289
"__setitem__($self, key, value, /)\n--\n\nSet self[key] to value."),
62906290
MPSLOT("__delitem__", mp_ass_subscript, slot_mp_ass_subscript,
62916291
wrap_delitem,
6292-
"__delitem__(key)\n--\n\nDelete self[key]."),
6292+
"__delitem__($self, key, /)\n--\n\nDelete self[key]."),
62936293

62946294
SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc,
62956295
"__len__($self, /)\n--\n\nReturn len(self)."),

0 commit comments

Comments
 (0)