]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport of issue 1755179 fix.
authorFacundo Batista <facundobatista@gmail.com>
Mon, 7 Jan 2008 16:49:02 +0000 (16:49 +0000)
committerFacundo Batista <facundobatista@gmail.com>
Mon, 7 Jan 2008 16:49:02 +0000 (16:49 +0000)
Lib/os.py

index c8cc274ec829c6fe833265ad15d8ccae4d375f04..a36a6c8d3514b19f7fd5f834f92fafb3573aad34 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -23,7 +23,7 @@ and opendir), and leave all pathname manipulation to os.path
 
 #'
 
-import sys
+import sys, errno
 
 _names = sys.builtin_module_names
 
@@ -156,7 +156,6 @@ def makedirs(name, mode=0777):
     recursive.
 
     """
-    from errno import EEXIST
     head, tail = path.split(name)
     if not tail:
         head, tail = path.split(head)
@@ -165,7 +164,7 @@ def makedirs(name, mode=0777):
             makedirs(head, mode)
         except OSError, e:
             # be happy if someone already created the path
-            if e.errno != EEXIST:
+            if e.errno != errno.EEXIST:
                 raise
         if tail == curdir:           # xxx/newdir/. exists if xxx/newdir exists
             return
@@ -365,8 +364,6 @@ def execvpe(file, args, env):
 __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])
 
 def _execvpe(file, args, env=None):
-    from errno import ENOENT, ENOTDIR
-
     if env is not None:
         func = execve
         argrest = (args, env)
@@ -392,7 +389,7 @@ def _execvpe(file, args, env=None):
             func(fullname, *argrest)
         except error, e:
             tb = sys.exc_info()[2]
-            if (e.errno != ENOENT and e.errno != ENOTDIR
+            if (e.errno != errno.ENOENT and e.errno != errno.ENOTDIR
                 and saved_exc is None):
                 saved_exc = e
                 saved_tb = tb