You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document that the built-in open() when called with a file descriptor ignores "mode" argument #95498
At https://docs.python.org/3/library/functions.html#open, in the documentation of the mode argument there is no information that this argument is ignored when the function is called with a file descriptor instead of a path.
This is an alias of the open() built-in function and accepts the same arguments.
so I think it should be enough to place the information in the documentation of the mode argument of the built-in open() function. This way it would document the built-in open() function but also the os.fdopen() function by virtue of the latter being an alias of the former.
builtin open() does not ignore the mode parameter. The argument is used to determinate the type of object. The open() function does not verify that the properties of the fd matches the arguments:
The open() function does not verify that the properties of the fd matches the arguments
Well, this is surprising. If the properties of the fd can't be verified (or it's undesired for them to be verified for some reason) then it should be clearly stated in the documentation that it's a caller's responsibility to match them with the value of the mode argument. Also in this case there should be information on what exactly matching the properties of the fd means.
Activity
tiran commentedon Jul 31, 2022
builtin
open()does not ignore the mode parameter. The argument is used to determinate the type of object. Theopen()function does not verify that the properties of the fd matches the arguments:piotr-dobrogost commentedon Jul 31, 2022
Well, this is surprising. If the properties of the fd can't be verified (or it's undesired for them to be verified for some reason) then it should be clearly stated in the documentation that it's a caller's responsibility to match them with the value of the
modeargument. Also in this case there should be information on what exactly matching the properties of the fd means.