New submission from Serhiy Storchaka <[email protected]>: Since dict is ordered, modules in sys.modules are ordered for the time of importing. Currently they are cleaned in PyImport_Cleanup() in the direct order -- from imported first to imported later. I wonder if cleaning them in the reversed order can solve some problems with the interpreter shutdown.
For example reverting the order fixes issue33328 and may help in other cases. If revert the order, should only iterating weaklist be reverted (with setting all module globals to None), or iterating sys.modules (with setting sys.module values to None) too? ---------- components: Interpreter Core messages: 315603 nosy: brett.cannon, eric.snow, ncoghlan, pitrou, serhiy.storchaka priority: normal severity: normal status: open title: Clean modules in the reversed order versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue33331> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
