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 arcivanov
Recipients BTaskaya, arcivanov, dino.viehland, vstinner
Date 2020-07-10.20:59:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> If sys.modules['_ast'] is cleared and then _ast is imported again, _PyState_AddModule() is called to store the new _ast module instance which calls astmodule_clear() on the old module instance.

I'm confused about this. In the repro below the sys.modules.clear() is indeed cleared, but references to all modules are retained. 

Where is the garbage collection/module re-initialization coming from? All of the references are live.
Date User Action Args
2020-07-10 20:59:10arcivanovsetrecipients: + arcivanov, vstinner, dino.viehland, BTaskaya
2020-07-10 20:59:10arcivanovsetmessageid: <>
2020-07-10 20:59:10arcivanovlinkissue41261 messages
2020-07-10 20:59:10arcivanovcreate