homepage

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 brett.cannon, eric.snow, vstinner
Date 2016年03月24日.15:06:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458831993.32.0.609008052486.issue26637@psf.upfronthosting.co.za>
In-reply-to
Content
Example of script.py:
-------------------------
class Bla:
 def __del__(self):
 try:
 import xxxx
 except Exception as exc:
 print("import error: [%s] %r" % (type(exc), exc))
bla = Bla()
-------------------------
Running this example logs a strange error:
-------------------------
$ python3.5 script.py
import error: [<class 'TypeError'>] TypeError("'NoneType' object is not iterable",)
-------------------------
The error comes from importlib._bootstrap._find_spec() which tries to iterator on sys.meta_path, whereas PyImport_Cleanup() was called and this function setted sys.meta_path to None.
Attached patch enhances _find_spec() to handle this case to return None. Error with the patch:
-------------------------
$ python3.5 script.py
import error: [<class 'ImportError'>] ImportError('sys.meta_path is None, Python is likely shutting down',)
-------------------------
History
Date User Action Args
2016年03月24日 15:06:33vstinnersetrecipients: + vstinner, brett.cannon, eric.snow
2016年03月24日 15:06:33vstinnersetmessageid: <1458831993.32.0.609008052486.issue26637@psf.upfronthosting.co.za>
2016年03月24日 15:06:33vstinnerlinkissue26637 messages
2016年03月24日 15:06:32vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /