Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa52cbd

Browse files
committed
#14863: Update the documentation of os.fdopen()
2 parents 4715ca5 + 1a01ebc commit fa52cbd

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

Doc/library/os.rst

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -600,26 +600,13 @@ File Object Creation
600600
These functions create new :term:`file objects <file object>`. (See also :func:`open`.)
601601

602602

603-
.. function:: fdopen(fd[, mode[, bufsize]])
603+
.. function:: fdopen(fd, *args, **kwargs)
604604

605-
.. index:: single: I/O control; buffering
605+
Return an open file object connected to the file descriptor *fd*.
606+
This is an alias of :func:`open` and accepts the same arguments.
607+
The only difference is that the first argument of :func:`fdopen`
608+
must always be an integer.
606609

607-
Return an open file object connected to the file descriptor *fd*. The *mode*
608-
and *bufsize* arguments have the same meaning as the corresponding arguments to
609-
the built-in :func:`open` function.
610-
611-
When specified, the *mode* argument must start with one of the letters
612-
``'r'``, ``'w'``, ``'x'`` or ``'a'``, otherwise a :exc:`ValueError` is
613-
raised.
614-
615-
On Unix, when the *mode* argument starts with ``'a'``, the *O_APPEND* flag is
616-
set on the file descriptor (which the :c:func:`fdopen` implementation already
617-
does on most platforms).
618-
619-
Availability: Unix, Windows.
620-
621-
.. versionchanged:: 3.3
622-
The ``'x'`` mode was added.
623610

624611
.. _os-fd-ops:
625612

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Core and Builtins
4242
Library
4343
-------
4444

45+
- Issue #14863: Update the documentation of os.fdopen() to reflect the
46+
fact that it's only a thin wrapper around open() anymore.
47+
4548
- Issue #14036: Add an additional check to validate that port in urlparse does
4649
not go in illegal range and returns None.
4750

0 commit comments

Comments
 (0)