[py-svn] r36767 - py/dist/py/path/local

arigo at codespeak.net arigo at codespeak.net
Mon Jan 15 11:33:23 CET 2007


Author: arigo
Date: Mon Jan 15 11:33:17 2007
New Revision: 36767

Modified:
   py/dist/py/path/local/local.py
Log:
A race condition (found by a PyPy failure on the parallelized autotest
run on wyvern).


Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py	(original)
+++ py/dist/py/path/local/local.py	Mon Jan 15 11:33:17 2007
@@ -280,7 +280,13 @@
         if parent.check(dir=0):
             parent._ensuredirs()
         if self.check(dir=0):
-            self.mkdir()
+            try:
+                self.mkdir()
+            except py.error.EEXIST:
+                # race condition: file/dir created by another thread/process.
+                # complain if it is not a dir
+                if self.check(dir=0):
+                    raise
         return self
 
     def ensure(self, *args, **kwargs):


More information about the py-svn mailing list