[issue41451] Cannot subclass typing.Generic with __weakref__ slot in Python 3.6

Joshua Oreman report at bugs.python.org
Sat Aug 1 01:07:32 EDT 2020


Joshua Oreman <oremanj at gmail.com> added the comment:

The problem appears to be occurring when the base class is subscripted, not when it's inherited. I can reproduce this issue on Python 3.6.10 by just evaluating Base[T].

'del Base.__slots__' after Base is constructed seems to work around the issue, and allow Base[T] to be evaluated. Of course, Base is still slotted at this point, since __slots__ are consulted only when initially building the class.

----------
nosy: +Joshua Oreman

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


More information about the Python-bugs-list mailing list