From 1d02e27737152ce5aa0f3f1c33e7e5804e81198f Mon Sep 17 00:00:00 2001 From: Raihan Shiras Date: Sun, 20 Sep 2026 20:56:08 +0530 Subject: [PATCH] gh-95498: Document open() behavior with file descriptors --- Doc/builtins/functions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/builtins/functions.rst b/Doc/builtins/functions.rst index 5cce5e3c87628a..0ab552d6deb628 100644 --- a/Doc/builtins/functions.rst +++ b/Doc/builtins/functions.rst @@ -1453,6 +1453,10 @@ are always available. They are listed here in alphabetical order. given, it is closed when the returned I/O object is closed unless *closefd* is set to ``False``.) + When *file* is an existing file descriptor, *open* does not change the access + mode of the file descriptor. The caller is responsible for ensuring that + the file descriptor is compatible with the requested *mode*. + *mode* is an optional string that specifies the mode in which the file is opened. It defaults to ``'r'`` which means open for reading in text mode. Other common values are ``'w'`` for writing (truncating the file if it