mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Issue #6612: Fix site and sysconfig to catch os.getcwd() error, eg. if the
current directory was deleted.
This commit is contained in:
parent
6c314ec946
commit
b103a937ea
3 changed files with 29 additions and 11 deletions
10
Lib/site.py
10
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue