summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-06-21 20:32:24 (GMT)
committerGitHub <noreply@github.com>2022-06-21 20:32:24 (GMT)
commit1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c (patch)
tree2522e6300a8d7784f7def20a0a3772c50df5a4e9 /Objects
parent4b2d7f3f4e160fdb482eefa377882d1c2c8ccb1b (diff)
downloadcpython-1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c.zip
cpython-1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c.tar.gz
cpython-1b8aa7aafd2ac07836777707fd9ba5ffb353eb0c.tar.bz2
gh-93021: Fix __text_signature__ for __get__ (GH-93023) (GH-94086)
Because of the way wrap_descr_get is written, the second argument to __get__ methods implemented through the wrapper is always optional. (cherry picked from commit 4e08fbcfdfa57ea94091aabdd09413708e3fb2bf) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 65a9475..d3a0bba 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6907,7 +6907,7 @@ wrap_descr_get(PyObject *self, PyObject *args, void *wrapped)
obj = NULL;
if (type == Py_None)
type = NULL;
- if (type == NULL &&obj == NULL) {
+ if (type == NULL && obj == NULL) {
PyErr_SetString(PyExc_TypeError,
"__get__(None, None) is invalid");
return NULL;
@@ -7950,7 +7950,7 @@ static slotdef slotdefs[] = {
TPSLOT("__next__", tp_iternext, slot_tp_iternext, wrap_next,
"__next__($self, /)\n--\n\nImplement next(self)."),
TPSLOT("__get__", tp_descr_get, slot_tp_descr_get, wrap_descr_get,
- "__get__($self, instance, owner, /)\n--\n\nReturn an attribute of instance, which is of type owner."),
+ "__get__($self, instance, owner=None, /)\n--\n\nReturn an attribute of instance, which is of type owner."),
TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set,
"__set__($self, instance, value, /)\n--\n\nSet an attribute of instance to value."),
TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set,