[Python-checkins] cpython (merge 3.4 -> default): Issue #20604: Added missed invalid mode in error message of socket.makefile().
serhiy.storchaka
python-checkins at python.org
Wed Nov 19 11:36:39 CET 2014
https://hg.python.org/cpython/rev/d5b36edeecdb
changeset: 93511:d5b36edeecdb
parent: 93509:712f246da49b
parent: 93510:34c7be03259b
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Nov 19 12:34:07 2014 +0200
summary:
Issue #20604: Added missed invalid mode in error message of socket.makefile().
Based on patch by Franck Michea.
files:
Lib/socket.py | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/Lib/socket.py b/Lib/socket.py
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -209,9 +209,8 @@
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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list