mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
Merge 6c7026fc48 into a273bc99d2
This commit is contained in:
commit
6774e205ee
3 changed files with 2 additions and 15 deletions
|
|
@ -2173,12 +2173,6 @@ class ClassPropertiesAndMethods(unittest.TestCase):
|
|||
return 1j
|
||||
def stop(self):
|
||||
raise StopIteration
|
||||
def return_true(self, thing=None):
|
||||
return True
|
||||
def do_isinstance(obj):
|
||||
return isinstance(int, obj)
|
||||
def do_issubclass(obj):
|
||||
return issubclass(int, obj)
|
||||
def do_dict_missing(checker):
|
||||
class DictSub(checker.__class__, dict):
|
||||
pass
|
||||
|
|
@ -2199,11 +2193,8 @@ class ClassPropertiesAndMethods(unittest.TestCase):
|
|||
("__length_hint__", list, zero, set(),
|
||||
{"__iter__" : iden, "__next__" : stop}),
|
||||
("__sizeof__", sys.getsizeof, zero, set(), {}),
|
||||
("__instancecheck__", do_isinstance, return_true, set(), {}),
|
||||
("__missing__", do_dict_missing, some_number,
|
||||
set(("__class__",)), {}),
|
||||
("__subclasscheck__", do_issubclass, return_true,
|
||||
set(("__bases__",)), {}),
|
||||
("__enter__", run_context, iden, set(), {"__exit__" : swallow}),
|
||||
("__exit__", run_context, swallow, set(), {"__enter__" : iden}),
|
||||
("__complex__", complex, complex_num, set(), {}),
|
||||
|
|
|
|||
|
|
@ -2691,9 +2691,6 @@ object_recursive_isinstance(PyThreadState *tstate, PyObject *inst, PyObject *cls
|
|||
|
||||
return ok;
|
||||
}
|
||||
else if (_PyErr_Occurred(tstate)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* cls has no __instancecheck__() method */
|
||||
return object_isinstance(inst, cls);
|
||||
|
|
@ -2779,9 +2776,6 @@ object_issubclass(PyThreadState *tstate, PyObject *derived, PyObject *cls)
|
|||
}
|
||||
return ok;
|
||||
}
|
||||
else if (_PyErr_Occurred(tstate)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Can be reached when infinite recursion happens. */
|
||||
return recursive_issubclass(derived, cls);
|
||||
|
|
|
|||
|
|
@ -654,6 +654,8 @@ static const char* const attr_exceptions[] = {
|
|||
"__parameters__",
|
||||
"__typing_unpacked_tuple_args__",
|
||||
"__mro_entries__",
|
||||
"__instancecheck__",
|
||||
"__subclasscheck__",
|
||||
"__reduce_ex__", // needed so we don't look up object.__reduce_ex__
|
||||
"__reduce__",
|
||||
NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue