#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.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index b39ec1b..ff37d10 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -481,6 +481,20 @@
:func:`fdopen`, use its :meth:`close` method.
+.. function:: closerange(fd_low, fd_high)
+
+ Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
+ ignoring errors. Availability: Macintosh, Unix, Windows. Equivalent to::
+
+ for fd in xrange(fd_low, fd_high):
+ try:
+ os.close(fd)
+ except OSError:
+ pass
+
+ .. versionadded:: 2.6
+
+
.. function:: dup(fd)
Return a duplicate of file descriptor *fd*. Availability: Macintosh, Unix,