diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-12 22:23:23 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-12 22:23:23 (GMT) |
commit | b103a937eab54ed9a42fbc8c75d45246389d3002 (patch) | |
tree | 9147fa3b3bb7ed9c5aaa747707a36aca7832166b /Lib/site.py | |
parent | 6c314ec946b9e3075707557e74b91d33eed82e07 (diff) | |
download | cpython-b103a937eab54ed9a42fbc8c75d45246389d3002.zip cpython-b103a937eab54ed9a42fbc8c75d45246389d3002.tar.gz cpython-b103a937eab54ed9a42fbc8c75d45246389d3002.tar.bz2 |
Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 10 |
1 files changed, 7 insertions, 3 deletions
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 @@ USER_BASE = None 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 @@ def abs_paths(): 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 |