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 serhiy.storchaka
Recipients JanVok, methane, r.david.murray, serhiy.storchaka, smurfix, vinay.sajip, vstinner, yselivanov
Date 2017-02-22.09:30:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487755818.49.0.0110802787039.issue26789@psf.upfronthosting.co.za>
In-reply-to
Content
There are no guaranties. But in recent Python versions the order of finalising is more predicable. It is hard to reproduce a case when some builtins or sys member is not available (with some exceptions).

The order of clearing (see PyImport_Cleanup() in Python/import.c):

1. Clear builtins._ and selected sys members (in particular this breaks import). Restore standard IO streams.

2. Clear sys.modules and all modules that don't have external references.

3. Restore builtins to its initial state (in particular builtins.open no longer available).

4. Clear the content of still alive modules except sys and builtins.

5. Clear sys.

6. Clear builtins.
History
Date User Action Args
2017-02-22 09:30:18serhiy.storchakasetrecipients: + serhiy.storchaka, vinay.sajip, vstinner, smurfix, r.david.murray, methane, yselivanov, JanVok
2017-02-22 09:30:18serhiy.storchakasetmessageid: <1487755818.49.0.0110802787039.issue26789@psf.upfronthosting.co.za>
2017-02-22 09:30:18serhiy.storchakalinkissue26789 messages
2017-02-22 09:30:18serhiy.storchakacreate