From: Yury Selivanov <yselivanov@sprymix.com>
Date: Sun, 2 Mar 2014 17:25:27 +0000 (-0500)
Subject: Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__
X-Git-Tag: v3.4.1rc1~233^2~156
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=056e2654911b404538d1169f34a576b26bde2ca0;p=python

Issue #20786: Fix signatures for dict.__delitem__ and property.__delete__
---

diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 0dc74512a2..5c6ae394d5 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -1764,6 +1764,11 @@ class TestSignatureObject(unittest.TestCase):
                 __call__ = type
             test_callable(ThisWorksNow())
 
+        # Regression test for issue #20786
+        test_unbound_method(dict.__delitem__)
+        test_unbound_method(property.__delete__)
+
+
     @cpython_only
     @unittest.skipIf(MISSING_C_DOCSTRINGS,
                      "Signature information for builtins requires docstrings")
diff --git a/Misc/NEWS b/Misc/NEWS
index d54cfba7d7..3af41ea0d6 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -14,6 +14,9 @@ Core and Builtins
 - Issue #20637: Key-sharing now also works for instance dictionaries of
   subclasses.  Patch by Peter Ingebretson.
 
+- Issue #20786: Fix signatures for dict.__delitem__ and
+  property.__delete__ builtins.
+
 Library
 -------
 
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 5a41387bc1..df8f351238 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6192,7 +6192,7 @@ static slotdef slotdefs[] = {
            "__set__($self, instance, value, /)\n--\n\nSet an attribute of instance to value."),
     TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set,
            wrap_descr_delete,
-           "__delete__(instance, /)\n--\n\nDelete an attribute of instance."),
+           "__delete__($self, instance, /)\n--\n\nDelete an attribute of instance."),
     FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init,
            "__init__($self, /, *args, **kwargs)\n--\n\n"
            "Initialize self.  See help(type(self)) for accurate signature.",
@@ -6289,7 +6289,7 @@ static slotdef slotdefs[] = {
            "__setitem__($self, key, value, /)\n--\n\nSet self[key] to value."),
     MPSLOT("__delitem__", mp_ass_subscript, slot_mp_ass_subscript,
            wrap_delitem,
-           "__delitem__(key)\n--\n\nDelete self[key]."),
+           "__delitem__($self, key, /)\n--\n\nDelete self[key]."),
 
     SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc,
            "__len__($self, /)\n--\n\nReturn len(self)."),