Mercurial > cpython-lru_cache-weakref
diff Lib/subprocess.py @ 44785:b520d33bee06 legacy-trunk
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 19 Jan 2008 20:22:13 +0000 |
| parents | ec3b8e94a355 |
| children | 210323e2a927 |
line wrap: on
line diff
--- a/Lib/subprocess.py Sat Jan 19 20:12:04 2008 +0000 +++ b/Lib/subprocess.py Sat Jan 19 20:22:13 2008 +0000 @@ -965,13 +965,8 @@ def _close_fds(self, but): - for i in xrange(3, MAXFD): - if i == but: - continue - try: - os.close(i) - except: - pass + os.closerange(3, but) + os.closerange(but + 1, MAXFD) def _execute_child(self, args, executable, preexec_fn, close_fds,
