This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Arfrever, josh.r, llllllllll, mark.dickinson, martin.panter, python-dev, r.david.murray, rhettinger, serhiy.storchaka, steven.daprano, taleinat
Date 2015-11-02.07:48:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2015-11-02 07:48:54serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, taleinat, Arfrever, steven.daprano, r.david.murray, python-dev, martin.panter, josh.r, llllllllll
2015-11-02 07:48:54serhiy.storchakasetmessageid: <>
2015-11-02 07:48:54serhiy.storchakalinkissue24379 messages
2015-11-02 07:48:54serhiy.storchakacreate