[issue33331] Clean modules in the reversed order

2018-10-29 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> enhancement versions: -Python 3.6, Python 3.7 ___ Python tracker

[issue33331] Clean modules in the reversed order

2018-10-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c93c58b5d560cfe44d9884ff02c9b18e0660 by Serhiy Storchaka in branch 'master': bpo-1: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565) https://github.com/python/cpython/commit/c93c58b5d560cfe44d9884ff02c9b18e0660

[issue33331] Clean modules in the reversed order

2018-10-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: While this change fixes issue33328, it doesn't help with the similar issue13044 which is more complex. Still I think there is a value of wiping modules in such order. -- ___ Python tracker

[issue33331] Clean modules in the reversed order

2018-10-03 Thread Nick Coghlan
Nick Coghlan added the comment: Aye, that option sounds like it would work to me (as long as throwing an exception is counted as finishing execution, so the failed module gets moved to the end before getting cleaned up) -- ___ Python tracker

[issue33331] Clean modules in the reversed order

2018-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If move a module to the end of sys.modules when it have finished execution, we will get the following order: D, C, B, A, Y, Z, X, __main__ In can be cleaned from the end, and each module will be cleaned before its dependencies. --

[issue33331] Clean modules in the reversed order

2018-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: It also occurred to me to ask whether or not moving modules to the end of sys.modules each time they're successfully imported would help solve the problem (albeit at the expense of making import cache hits more expensive). I don't think it does, though, since

[issue33331] Clean modules in the reversed order

2018-06-08 Thread Nick Coghlan
Nick Coghlan added the comment: I think the key concern here is that we *don't* consistently add modules to sys.modules in the order their bodies are executed: we add them in a kind of sawtooth order based on the imports from __main__, and the order of import statements in the imported

[issue33331] Clean modules in the reversed order

2018-04-22 Thread Barry A. Warsaw
Change by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list

[issue33331] Clean modules in the reversed order

2018-04-22 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6260 stage: -> patch review ___ Python tracker ___

[issue33331] Clean modules in the reversed order

2018-04-22 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : 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