=================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.50.8.2 retrieving revision 1.50.8.4 diff -u -r1.50.8.2 -r1.50.8.4 --- python/python/dist/src/Lib/os.py 2002/03/16 18:02:20 1.50.8.2 +++ python/python/dist/src/Lib/os.py 2002/09/03 16:36:59 1.50.8.4 @@ -298,7 +298,7 @@ _execvpe(file, args) def execvpe(file, args, env): - """execv(file, args, env) + """execvpe(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the @@ -308,8 +308,9 @@ __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) -_notfound = None def _execvpe(file, args, env=None): + from errno import ENOENT, ENOTDIR + if env is not None: func = execve argrest = (args, env) @@ -317,7 +318,7 @@ func = execv argrest = (args,) env = environ - global _notfound + head, tail = path.split(file) if head: apply(func, (file,) + argrest) @@ -327,30 +328,21 @@ else: envpath = defpath PATH = envpath.split(pathsep) - if not _notfound: - if sys.platform[:4] == 'beos': - # Process handling (fork, wait) under BeOS (up to 5.0) - # doesn't interoperate reliably with the thread interlocking - # that happens during an import. The actual error we need - # is the same on BeOS for posix.open() et al., ENOENT. - try: unlink('/_#.# ## #.#') - except error, _notfound: pass - else: - import tempfile - t = tempfile.mktemp() - # Exec a file that is guaranteed not to exist - try: execv(t, ('blah',)) - except error, _notfound: pass - exc, arg = error, _notfound + saved_exc = None + saved_tb = None for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) - except error, (errno, msg): - if errno != arg[0]: - exc, arg = error, (errno, msg) - raise exc, arg - + except error, e: + tb = sys.exc_info()[2] + if (e.errno != ENOENT and e.errno != ENOTDIR + and saved_exc is None): + saved_exc = e + saved_tb = tb + if saved_exc: + raise error, saved_exc, saved_tb + raise error, e, tb # Change environ to automatically call putenv() if it exists try: =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.4 retrieving revision 1.73.4.7 diff -u -r1.73.4.4 -r1.73.4.7 --- python/python/dist/src/setup.py 2002/03/26 13:43:04 1.73.4.4 +++ python/python/dist/src/setup.py 2002/08/08 19:52:42 1.73.4.7 @@ -273,8 +273,6 @@ exts.append( Extension('pwd', ['pwdmodule.c']) ) # grp(3) exts.append( Extension('grp', ['grpmodule.c']) ) - # posix (UNIX) errno values - exts.append( Extension('errno', ['errnomodule.c']) ) # select(2); not on ancient System V exts.append( Extension('select', ['selectmodule.c']) ) =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.24 retrieving revision 1.24.10.2 diff -u -r1.24 -r1.24.10.2 --- python/python/dist/src/Modules/Setup.dist 2001/10/17 13:46:28 1.24 +++ python/python/dist/src/Modules/Setup.dist 2002/08/08 19:52:42 1.24.10.2 @@ -97,6 +97,7 @@ # setup.py script in the root of the Python source tree. posix posixmodule.c # posix (UNIX) system calls +errno errnomodule.c # posix (UNIX) errno values _sre _sre.c # Fredrik Lundh's new regular expressions new newmodule.c # Tommy Burnette's 'new' module @@ -166,7 +167,6 @@ #fcntl fcntlmodule.c # fcntl(2) and ioctl(2) #pwd pwdmodule.c # pwd(3) #grp grpmodule.c # grp(3) -#errno errnomodule.c # posix (UNIX) errno values #select selectmodule.c # select(2); not on ancient System V