diff options
author | Facundo Batista <facundobatista@gmail.com> | 2007-11-27 18:50:12 +0000 |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2007-11-27 18:50:12 +0000 |
commit | 2ffd780858b304ac66bb1b71745717e27fff2b0f (patch) | |
tree | 4bc1fd223b09aa174cb0a9930ea424b3e84a211d /Lib/os.py | |
parent | 8fc2a34014fe21a9a3a530f5932e95662a0d6f5e (diff) | |
download | cpython-git-2ffd780858b304ac66bb1b71745717e27fff2b0f.tar.gz |
Moved the errno import from inside the functions to the
module level. Fixes issue 1755179.
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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 @@ -369,8 +368,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) @@ -396,7 +393,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 |