bpo-33331: Clean modules in the reversed order in PyImport_Cleanup(). (GH-6565)

Modules imported last are now cleared first at interpreter shutdown.

A newly imported module is moved to the end of sys.modules, behind
modules on which it depends.
4 files changed