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 brett.cannon
Recipients brett.cannon, corona10, eric.snow, ncoghlan, shihai1991, vstinner
Date 2020-03-24.17:09:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585069751.25.0.945850373073.issue40050@roundup.psfhosted.org>
In-reply-to
Content
From Victor:
* Maybe the test_importlib should before save/restore the the "Python state" rather than modifying modules

You will have to be more specific than that as there is an import_state() context manager to control import state via the sys module.


* Maybe module.__spec__ should leak less importlib internals: explicitly clear namespaces? Use static methods? I'm not sure how to do that.

Are you saying change everything on __spec__ objects to be static methods? That won't work because the whole point of __spec__ objects is to essentially be data classes to store details of a module.

* Remove module.__spec__? ... that would mean rejecting PEP 451 implemented in Python 3.4, that sounds like a major regression :-(

No. You would break the world and undo years of work to clean up import semantics with no good way to go back to the old way.

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? Also note that the use of weakrefs by importlib isn't tied to __spec__ objects but to per-module import locks in importlib._bootstrap.
History
Date User Action Args
2020-03-24 17:09:11brett.cannonsetrecipients: + brett.cannon, ncoghlan, vstinner, eric.snow, corona10, shihai1991
2020-03-24 17:09:11brett.cannonsetmessageid: <1585069751.25.0.945850373073.issue40050@roundup.psfhosted.org>
2020-03-24 17:09:11brett.cannonlinkissue40050 messages
2020-03-24 17:09:11brett.cannoncreate