self.assertIsInstance(object.__lt__, types.WrapperDescriptorType)
self.assertIsInstance(int.__lt__, types.WrapperDescriptorType)
+ def test_dunder_get_signature(self):
+ sig = inspect.signature(object.__init__.__get__)
+ self.assertEqual(list(sig.parameters), ["instance", "owner"])
+ # gh-93021: Second parameter is optional
+ self.assertIs(sig.parameters["owner"].default, None)
+
def test_method_wrapper_types(self):
self.assertIsInstance(object().__init__, types.MethodWrapperType)
self.assertIsInstance(object().__str__, types.MethodWrapperType)
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;
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,