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 vstinner
Recipients brett.cannon, corona10, eric.snow, ncoghlan, shihai1991, vstinner
Date 2020-03-24.17:15:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585070143.54.0.903461423343.issue40050@roundup.psfhosted.org>
In-reply-to
Content
I close the issue.

I pushed commit 83d46e0622d2efdf5f3bf8bf8904d0dcb55fc322 which should not be controversial. In short, the fix is to remove two unused imports :-D

The fix doesn't remove module.__spec__ nor avoid usage of _weakref, it only fix this issue (reference leak) by copying code from _bootstrap.py to _bootstrap_external.py. In fact, modules like _io were already correctly imported by _bootstrap_external._setup(). Only _thread, _weakref and winreg imports caused this bug.

I don't think that it's worth it to backport the change to stable branches 3.7 and 3.8, since stable branches don't use multiphase initialization for _weakref. The two unused imports don't cause any harm in importlib._bootstrap_external.


> Can I ask why you suddenly want to throw __spec__ objects out due to a leak tied back to _weakref switching to multi-phase initialization?

I was thinking just aloud to try to find a solution for this reference leak.
History
Date User Action Args
2020-03-24 17:15:43vstinnersetrecipients: + vstinner, brett.cannon, ncoghlan, eric.snow, corona10, shihai1991
2020-03-24 17:15:43vstinnersetmessageid: <1585070143.54.0.903461423343.issue40050@roundup.psfhosted.org>
2020-03-24 17:15:43vstinnerlinkissue40050 messages
2020-03-24 17:15:42vstinnercreate