summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index c4f6e64..66316dd 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -378,6 +378,20 @@ by file descriptors.
: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:: device_encoding(fd)
Return a string describing the encoding of the device associated with *fd*