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 cliff.cordeiro
Recipients cliff.cordeiro
Date 2021-08-07.02:20:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628302859.95.0.618033141977.issue44857@roundup.psfhosted.org>
In-reply-to
Content
This class is not collected by the gc without a custom __del__ method to del or assign None to self.fn:

import gc

class Leak:
    def __init__(self):
        self.fn = self.x

    def x(self):
        pass


gc.set_debug(gc.DEBUG_SAVEALL)

l = Leak()
del l
gc.collect()

for item in gc.garbage:
    print(item)
History
Date User Action Args
2021-08-07 02:20:59cliff.cordeirosetrecipients: + cliff.cordeiro
2021-08-07 02:20:59cliff.cordeirosetmessageid: <1628302859.95.0.618033141977.issue44857@roundup.psfhosted.org>
2021-08-07 02:20:59cliff.cordeirolinkissue44857 messages
2021-08-07 02:20:59cliff.cordeirocreate