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 Arfrever, vstinner
Date 2010年05月19日.16:46:55
SpamBayes Score 2.2869397e-09
Marked as misclassified No
Message-id <1274287617.97.0.156110792553.issue8766@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is that a warning is emited before the _warnings module is initialized: get_filter() uses _filters which is equal to NULL.
Attached patch initialize the _warnings module (but not the warnings module) before initfsencoding(). initfsencoding() is the first function loading modules (especially the encoding package) and so _warnings have to be initialized before.
The patch does also fix get_filter() to avoid the crash. This fix alone is not enough to fix this issue: Python cannot start because PyErr_WarnEx() returns -1 if _warnings is not initialized yet.
I tried to display the warning (Not importing directory '/tmp/encodings': missing __init__.py) but it looks to be impossible: display a warning requires that warnings is loaded, but import warnings emits the warning. warnings imports indirectly encodings (linecache -> tokenize -> codecs). I consider that avoiding the crash is enough :-)
--
The encodings can be not empty: the crash occurs if there is an encoding directory is sys.path without the __init__.py file.
 $ mkdir encodings
 $ touch encodings/a
 $ touch encodings/b
 $ touch encodings/c
 $ PYTHONPATH=$PWD ./python 
 Erreur de segmentation
History
Date User Action Args
2010年05月19日 16:46:58vstinnersetrecipients: + vstinner, Arfrever
2010年05月19日 16:46:57vstinnersetmessageid: <1274287617.97.0.156110792553.issue8766@psf.upfronthosting.co.za>
2010年05月19日 16:46:56vstinnerlinkissue8766 messages
2010年05月19日 16:46:56vstinnercreate

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