Skip to content

Commit a1c2052

Browse files
[3.12] gh-110383: Document socket.makefile() accepts combined modes (GH-119150) (#119325)
The supported mode values are 'r', 'w', and 'b', or a combination of those. (cherry picked from commit 62a29be) Co-authored-by: Daniel Williams <dann0a@gmail.com>
1 parent 4dfba85 commit a1c2052

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/library/socket.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,8 @@ to sockets.
15841584
Return a :term:`file object` associated with the socket. The exact returned
15851585
type depends on the arguments given to :meth:`makefile`. These arguments are
15861586
interpreted the same way as by the built-in :func:`open` function, except
1587-
the only supported *mode* values are ``'r'`` (default), ``'w'`` and ``'b'``.
1587+
the only supported *mode* values are ``'r'`` (default), ``'w'``, ``'b'``, or
1588+
a combination of those.
15881589

15891590
The socket must be in blocking mode; it can have a timeout, but the file
15901591
object's internal buffer may end up in an inconsistent state if a timeout

Lib/socket.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ def makefile(self, mode="r", buffering=None, *,
306306
"""makefile(...) -> an I/O stream connected to the socket
307307
308308
The arguments are as for io.open() after the filename, except the only
309-
supported mode values are 'r' (default), 'w' and 'b'.
309+
supported mode values are 'r' (default), 'w', 'b', or a combination of
310+
those.
310311
"""
311312
# XXX refactor to share code?
312313
if not set(mode) <= {"r", "w", "b"}:

0 commit comments

Comments
 (0)