]> granicus.if.org Git - python/commitdiff
OSError is the exception raised when one tries to create a directory that
authorBrett Cannon <bcannon@gmail.com>
Thu, 26 Aug 2010 21:07:13 +0000 (21:07 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 26 Aug 2010 21:07:13 +0000 (21:07 +0000)
already exists, not IOError.

Part of the continuing saga of issue #9572.

Lib/importlib/_bootstrap.py

index 5566b78bf024ce281ce88c9bd49954cdcf908e3c..9130a928e8fc75409f6e2078d65d545962653fff 100644 (file)
@@ -493,13 +493,16 @@ class _SourceFileLoader(_FileLoader, SourceLoader):
             parent = _path_join(parent, part)
             try:
                 _os.mkdir(parent)
-            except IOError as exc:
+            except OSError as exc:
                 # Probably another Python process already created the dir.
                 if exc.errno == errno.EEXIST:
                     continue
+                else:
+                    raise
+            except IOError as exc:
                 # If can't get proper access, then just forget about writing
                 # the data.
-                elif exc.errno == errno.EACCES:
+                if exc.errno == errno.EACCES:
                     return
                 else:
                     raise