While testing my tempfile.py rewrite I ran into this mess in os.py: def _execvpe(file, args, env=None): # ... 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 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 This appears to be an overcomplicated, unreliable way of writing import errno def _execvpe(file, args, env=None): # ... for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (err, msg): if err != errno.ENOENT: # and err != errno.ENOTDIR, maybe raise raise error, (err, msg) Can anyone explain why it is done this way? zw
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4