Author Mark.Shannon
Recipients Mark.Shannon, abarry, mdk, serhiy.storchaka, sjpalt, vstinner
Date 2019-05-06.18:08:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557166100.67.0.559705219874.issue28866@roundup.psfhosted.org>
In-reply-to
Content
This failure appears to be a symptom of recursively traversing __bases__ rather scanning __mro__ in the implementation of type.__subclasses__
The MCACHE depends on type.__subclasses__ being correct and it is not correct for weird.py

python -i weird.py
>>> C = Meta("C", (), {})
>>> C.__mro__
(<class '__main__.C'>, <class '__main__.Foo'>, <class 'object'>)
>>> Foo.__subclasses__()
[]
>>> C.__bases__
(<class 'object'>,)

Fixing this may need a change in the API for type.__subclasses__() to return all subclasses, as defined by __mro__, not just the bases.

A simpler, temporary fix might be to set Py_TPFLAGS_HAVE_VERSION_TAG to 0 for any class that has a custom mro()
History
Date User Action Args
2019-05-06 18:08:20Mark.Shannonsetrecipients: + Mark.Shannon, vstinner, serhiy.storchaka, abarry, mdk, sjpalt
2019-05-06 18:08:20Mark.Shannonsetmessageid: <1557166100.67.0.559705219874.issue28866@roundup.psfhosted.org>
2019-05-06 18:08:20Mark.Shannonlinkissue28866 messages
2019-05-06 18:08:20Mark.Shannoncreate