(original) (raw)
changeset: 83319:faa5d705c27d branch: 3.3 parent: 83308:15c600674944 user: Meador Inge meadori@gmail.com date: Sat Apr 13 20:29:49 2013 -0500 files: Lib/site.py Misc/NEWS description: 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. diff -r 15c600674944 -r faa5d705c27d Lib/site.py --- a/Lib/site.py Sat Apr 13 14:40:51 2013 -0400 +++ b/Lib/site.py Sat Apr 13 20:29:49 2013 -0500 @@ -620,14 +620,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 -r 15c600674944 -r faa5d705c27d Misc/NEWS --- a/Misc/NEWS Sat Apr 13 14:40:51 2013 -0400 +++ b/Misc/NEWS Sat Apr 13 20:29:49 2013 -0500 @@ -29,6 +29,9 @@ Library ------- +- Issue #16804: Fix a bug in the 'site' module that caused running + 'python -S -m site' to incorrectly throw an exception. + - Issue #17016: Get rid of possible pointer wraparounds and integer overflows in the re module. Patch by Nickolai Zeldovich. /meadori@gmail.com