[Python-checkins] cpython (merge 3.3 -> default): Issue #16804: Fix 'python -S -m site' failure.
meador.inge
python-checkins at python.org
Sun Apr 14 04:00:34 CEST 2013
http://hg.python.org/cpython/rev/8cbd8d8ac828
changeset: 83320:8cbd8d8ac828
parent: 83317:d621bdaed7c3
parent: 83319:faa5d705c27d
user: Meador Inge <meadori at gmail.com>
date: Sat Apr 13 20:51:04 2013 -0500
summary:
Issue #16804: Fix 'python -S -m site' failure.
This commit fixes a bug in the 'site' module that was causing an exception
to incorrectly be thrown when running 'python -S -m site'. The problem was
that 'USER_BASE' and 'USER_SITE' were being accessed before they were properly
initialized. The code has been changed to use 'getuserbase' and
'getusersitepackages' instead so that the initialization always happens.
files:
Lib/site.py | 10 ++++++----
Misc/NEWS | 3 +++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Lib/site.py b/Lib/site.py
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -598,14 +598,16 @@
"""
args = sys.argv[1:]
if not args:
+ user_base = getuserbase()
+ user_site = getusersitepackages()
print("sys.path = [")
for dir in sys.path:
print(" %r," % (dir,))
print("]")
- print("USER_BASE: %r (%s)" % (USER_BASE,
- "exists" if os.path.isdir(USER_BASE) else "doesn't exist"))
- print("USER_SITE: %r (%s)" % (USER_SITE,
- "exists" if os.path.isdir(USER_SITE) else "doesn't exist"))
+ print("USER_BASE: %r (%s)" % (user_base,
+ "exists" if os.path.isdir(user_base) else "doesn't exist"))
+ print("USER_SITE: %r (%s)" % (user_site,
+ "exists" if os.path.isdir(user_site) else "doesn't exist"))
print("ENABLE_USER_SITE: %r" % ENABLE_USER_SITE)
sys.exit(0)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,6 +46,9 @@
Library
-------
+- Issue #16804: Fix a bug in the 'site' module that caused running
+ 'python -S -m site' to incorrectly throw an exception.
+
- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal.
Initial patch by Daniel Riti.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list