Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
diff --git a/Lib/site.py b/Lib/site.py
index 51516aa..9d1084a 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -70,7 +70,11 @@
def makepath(*paths):
- dir = os.path.abspath(os.path.join(*paths))
+ dir = os.path.join(*paths)
+ try:
+ dir = os.path.abspath(dir)
+ except OSError:
+ pass
return dir, os.path.normcase(dir)
@@ -81,11 +85,11 @@
continue # don't mess with a PEP 302-supplied __file__
try:
m.__file__ = os.path.abspath(m.__file__)
- except AttributeError:
+ except (AttributeError, OSError):
pass
try:
m.__cached__ = os.path.abspath(m.__cached__)
- except AttributeError:
+ except (AttributeError, OSError):
pass