mirror of https://github.com/python/cpython.git
When getcwd() doesn't exist or raises an exception, don't fail but
fall back to using os.curdir instead; if it is fine, don't use os.curdir at all.
This commit is contained in:
parent
c09e6b1c0a
commit
29e5f5d81f
|
@ -20,7 +20,11 @@ def gettempdir():
|
||||||
global tempdir
|
global tempdir
|
||||||
if tempdir is not None:
|
if tempdir is not None:
|
||||||
return tempdir
|
return tempdir
|
||||||
attempdirs = ['/usr/tmp', '/tmp', os.getcwd(), os.curdir]
|
try:
|
||||||
|
pwd = os.getcwd()
|
||||||
|
except (AttributeError, os.error):
|
||||||
|
pwd = os.curdir
|
||||||
|
attempdirs = ['/usr/tmp', '/tmp', pwd]
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
attempdirs.insert(0, 'C:\\TEMP')
|
attempdirs.insert(0, 'C:\\TEMP')
|
||||||
attempdirs.insert(0, '\\TEMP')
|
attempdirs.insert(0, '\\TEMP')
|
||||||
|
|
Loading…
Reference in New Issue