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 benjamin.peterson, gjb1002, vstinner
Date 2010-03-08.00:10:17
SpamBayes Score 4.8516746e-14
Marked as misclassified No
Message-id <1268007020.8.0.826021466374.issue3137@psf.upfronthosting.co.za>
In-reply-to
Content
I think initsite() should be atomic: if any kind of error occurs, Python should print it and exit directly (exit code 1 to notice the error). If initsite() fails, Python is not complelty initialized.

site is responsible to initialiaze a lot of things:

 - Set all module' __file__ attribute to an absolute path
 - Remove duplicate entries from sys.path along with making them absolute
 - Add a per user site-package to sys.path
 - Add site-packages (and possibly site-python) to sys.path
 - Define new built-ins 'quit' and 'exit'.
 - Set 'copyright' and 'credits' in __builtin__"
 - Create builtin help() function
 - On Windows, some default encodings are not provided by Python, while they are always available as "mbcs" in each locale. Make them usable by aliasing to "mbcs" in such a case.
 - import sitecustomize
 - import usercustomize
 - del sys.setdefaultencoding
 - etc.

Be able to ignore the site initializations might be a security vulnerability.

Attached patch consider any exception as fatal: display the error and exit. I moved the call to _PyGILState_Init() before initsite() to avoid a crash in Py_Finalize() => see #8063.
History
Date User Action Args
2010-03-08 00:10:20vstinnersetrecipients: + vstinner, gjb1002, benjamin.peterson
2010-03-08 00:10:20vstinnersetmessageid: <1268007020.8.0.826021466374.issue3137@psf.upfronthosting.co.za>
2010-03-08 00:10:18vstinnerlinkissue3137 messages
2010-03-08 00:10:17vstinnercreate