]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 1.45:
authorRaymond Hettinger <python@rcn.com>
Sun, 6 Oct 2002 03:52:44 +0000 (03:52 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 6 Oct 2002 03:52:44 +0000 (03:52 +0000)
Fix a problem in site.py which triggers in case sys.path is empty.

Bugfix candidate for 2.2.2.

Lib/site.py

index 09043a8b4a551c3abd9d3411dde58db3918658c4..70f1b8b885ccf3e785914a7fa7a8e7554e8d68ba 100644 (file)
@@ -92,7 +92,8 @@ del dir, L
 
 # Append ./build/lib.<platform> in case we're running in the build dir
 # (especially for Guido :-)
-if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules":
+if (os.name == "posix" and sys.path and
+    os.path.basename(sys.path[-1]) == "Modules"):
     from distutils.util import get_platform
     s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
     s = os.path.join(os.path.dirname(sys.path[-1]), s)