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 vstinner
Recipients serhiy.storchaka, vstinner
Date 2020-12-17.22:05:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608242748.14.0.0960707187925.issue42671@roundup.psfhosted.org>
In-reply-to
Content
> Modules are already cleared in the reverse order.

In Python 3.9, _PyImport_Cleanup() of Python/import.c contains the comment:

        /* Since dict is ordered in CPython 3.6+, modules are saved in
           importing order.  First clear modules imported later. */

But using Python 3.9, the z.py example output is:
---
a
b
c
---

The most recently imported module is the last one to be deleted.

The first loop iterates on sys.modules, not on reversed(sys.modules).
History
Date User Action Args
2020-12-17 22:05:48vstinnersetrecipients: + vstinner, serhiy.storchaka
2020-12-17 22:05:48vstinnersetmessageid: <1608242748.14.0.0960707187925.issue42671@roundup.psfhosted.org>
2020-12-17 22:05:48vstinnerlinkissue42671 messages
2020-12-17 22:05:48vstinnercreate