New submission from Carl Meyer <c...@dirtcircle.com>:

If python is run with the -S flag, that declares the intent of the user to not 
have site-specific additions to sys.path.

However, some code in that process may have a legitimate need for a function 
defined in site.py - for instance, addsitedir. But the act of importing 
site.py, as a side effect, adds the standard site-specific directories to 
sys.path.

python -S would be more useful and reliable if it prevented importing site from 
automatically making the sys.path additions. There is no loss of flexibility 
here, as user code could still explicitly call site.main() to achieve all of 
the current side-effects of "import site".

The fix is a one-liner, and is in the linked hg repository.

----------
components: Library (Lib)
hgrepos: 4
messages: 131281
nosy: carljm
priority: normal
severity: normal
status: open
title: "python -S" should be robust against e.g. "from site import addsitedir"
type: behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11591>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to