Commit a9568bb4 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #20604: Added missed invalid mode in error message of socket.makefile().

Based on patch by Franck Michea.
parents 1d922d0c fca2fc09
......@@ -209,9 +209,8 @@ class socket(_socket.socket):
except the only mode characters supported are 'r', 'w' and 'b'.
The semantics are similar too. (XXX refactor to share code?)
"""
for c in mode:
if c not in {"r", "w", "b"}:
raise ValueError("invalid mode %r (only r, w, b allowed)")
if not set(mode) <= {"r", "w", "b"}:
raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
writing = "w" in mode
reading = "r" in mode or not writing
assert reading or writing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment