Message100617
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. |
|
Date |
User |
Action |
Args |
2010-03-08 00:10:20 | vstinner | set | recipients:
+ vstinner, gjb1002, benjamin.peterson |
2010-03-08 00:10:20 | vstinner | set | messageid: <1268007020.8.0.826021466374.issue3137@psf.upfronthosting.co.za> |
2010-03-08 00:10:18 | vstinner | link | issue3137 messages |
2010-03-08 00:10:17 | vstinner | create | |
|