summaryrefslogtreecommitdiffstats
path: root/Lib/tempfile.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-09-06 13:17:15 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-09-06 13:17:15 (GMT)
commit8c7e925f6ea1333c7f2838a7643bbe39c6eff6af (patch)
treea64e5adc7d3f4cb78e76ba5ebd00c2686f0c20a5 /Lib/tempfile.py
parentfb03696fdabeb850cdc714cd1abb45f6d93fcdf6 (diff)
downloadcpython-8c7e925f6ea1333c7f2838a7643bbe39c6eff6af.zip
cpython-8c7e925f6ea1333c7f2838a7643bbe39c6eff6af.tar.gz
cpython-8c7e925f6ea1333c7f2838a7643bbe39c6eff6af.tar.bz2
Close #18849: Fixed a Windows-specific tempfile bug where collision with an
existing directory caused mkstemp and related APIs to fail instead of retrying. Report and fix by Vlad Shcherbina.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r--Lib/tempfile.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index b5dce97..7154d2c 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -242,6 +242,10 @@ def _mkstemp_inner(dir, pre, suf, flags):
except OSError, e:
if e.errno == _errno.EEXIST:
continue # try again
+ if _os.name == 'nt' and e.errno == _errno.EACCES:
+ # On windows, when a directory with the chosen name already
+ # exists, EACCES error code is returned instead of EEXIST.
+ continue
raise
raise IOError, (_errno.EEXIST, "No usable temporary file name found")