[New-bugs-announce] [issue33331] Clean modules in the reversed order
report at bugs.python.org
Sun Apr 22 06:38:18 EDT 2018
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
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
nosy: brett.cannon, eric.snow, ncoghlan, pitrou, serhiy.storchaka
title: Clean modules in the reversed order
versions: Python 3.6, Python 3.7, Python 3.8
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce