mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Issue #16915: Clarify that mode parameter of socket.makefile() does not accept
the same values as open().
This commit is contained in:
parent
c12fef9aa3
commit
3fe64d0c5c
3 changed files with 19 additions and 4 deletions
|
@ -209,10 +209,10 @@ class socket(_socket.socket):
|
|||
encoding=None, errors=None, newline=None):
|
||||
"""makefile(...) -> an I/O stream connected to the socket
|
||||
|
||||
The arguments are as for io.open() after the filename,
|
||||
except the only mode characters supported are 'r', 'w' and 'b'.
|
||||
The semantics are similar too. (XXX refactor to share code?)
|
||||
The arguments are as for io.open() after the filename, except the only
|
||||
supported mode values are 'r' (default), 'w' and 'b'.
|
||||
"""
|
||||
# XXX refactor to share code?
|
||||
if not set(mode) <= {"r", "w", "b"}:
|
||||
raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
|
||||
writing = "w" in mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue