Port access, chmod, parts of getcwdu, mkdir, and utime to direct Win32 API.
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index dd7e864..83dfa17 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -327,6 +327,10 @@
try:
_os.mkdir(file, 0700)
return file
+ except WindowsError, e:
+ if e.errno == 183: # ERROR_ALREADY_EXISTS
+ continue # try again
+ raise
except OSError, e:
if e.errno == _errno.EEXIST:
continue # try again
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 5bb45f5..ffc9420 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -375,6 +375,18 @@
def test_chdir(self):
self.assertRaises(WindowsError, os.chdir, test_support.TESTFN)
+ def test_mkdir(self):
+ self.assertRaises(WindowsError, os.chdir, test_support.TESTFN)
+
+ def test_utime(self):
+ self.assertRaises(WindowsError, os.utime, test_support.TESTFN, None)
+
+ def test_access(self):
+ self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0)
+
+ def test_chmod(self):
+ self.assertRaises(WindowsError, os.utime, test_support.TESTFN, 0)
+
if sys.platform != 'win32':
class Win32ErrorTests(unittest.TestCase):
pass