Serhiy Storchaka added the comment:
The are is a reference loop:
global instance -> type -> method -> module globals -> global instance
Since an instance doesn't have GC head if __slots__ is empty, the loop can't be
broken.
A workaround is to add a stub element to __slots__:
__slots__ = ('__stub__',)
But operator.subscript is not the only class that causes a reference leak. Any
class with empty __slots__ can create a loop and cause a leak.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24379>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com