eryksun added the comment: Given super(cls, obj), cls needs to be somewhere in type(obj).__mro__. Thus the implementation checks PyType_IsSubtype instead of the more generic PyObject_IsSubclass.
In this case int's MRO is unrelated to numbers.Number: >>> print(*int.__mro__, sep='\n') <class 'int'> <class 'object'> It gets registered as a subclass via numbers.Integral.register(int). >>> print(*numbers.Integral._abc_registry) <class 'int'> issubclass calls PyObject_IsSubclass, which uses the __subclasscheck__ API. In this case ABCMeta.__subclasscheck__ recursively checks the registry and caches the result to speed up future checks. >>> numbers.Number.__subclasscheck__(int) True >>> print(*numbers.Number._abc_cache) <class 'int'> ---------- nosy: +eryksun _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20503> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com