STINNER Victor <victor.stin...@haypocalc.com> added the comment: 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. ---------- keywords: +patch nosy: +haypo Added file: http://bugs.python.org/file16488/initsite.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3137> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com