[issue38085] Interrupting class creation in __init_subclass__ may lead to incorrect isinstance() and issubclass() results

Carl Friedrich Bolz-Tereick report at bugs.python.org
Thu Dec 23 15:42:44 EST 2021


Carl Friedrich Bolz-Tereick <cfbolz at gmx.de> added the comment:

Or, in other words, in my opinion this is the root cause of the bug:

class Base:
    def __init_subclass__(cls):
        global broken_class
        broken_class = cls
        assert 0
try:
    class Broken(Base): pass
except: pass
assert broken_class not in Base.__subclasses__()

The assert fails, which imo it shouldn't.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38085>
_______________________________________


More information about the Python-bugs-list mailing list