Skip to content

Commit 1d02e27

Browse files
committed
gh-95498: Document open() behavior with file descriptors
1 parent 89c67a9 commit 1d02e27

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎Doc/builtins/functions.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,10 @@ are always available. They are listed here in alphabetical order.
14531453
given, it is closed when the returned I/O object is closed unless *closefd*
14541454
is set to ``False``.)
14551455

1456+
When *file* is an existing file descriptor, *open* does not change the access
1457+
mode of the file descriptor. The caller is responsible for ensuring that
1458+
the file descriptor is compatible with the requested *mode*.
1459+
14561460
*mode* is an optional string that specifies the mode in which the file is
14571461
opened. It defaults to ``'r'`` which means open for reading in text mode.
14581462
Other common values are ``'w'`` for writing (truncating the file if it

0 commit comments

Comments
 (0)