diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-19 10:33:40 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-19 10:33:40 (GMT) |
commit | fca2fc090c8227e8693a2b53dcdafd80bef06c1f (patch) | |
tree | 3b92cef40fdad77e3ec0fa6e244edde26fcebbc3 /Lib/socket.py | |
parent | db118f5db7ee8b52faf2c0bb32ed41e774609032 (diff) | |
download | cpython-fca2fc090c8227e8693a2b53dcdafd80bef06c1f.zip cpython-fca2fc090c8227e8693a2b53dcdafd80bef06c1f.tar.gz cpython-fca2fc090c8227e8693a2b53dcdafd80bef06c1f.tar.bz2 |
Issue #20604: Added missed invalid mode in error message of socket.makefile().
Based on patch by Franck Michea.
Diffstat (limited to 'Lib/socket.py')
-rw-r--r-- | Lib/socket.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index fd2a7d4..22d7ad5 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -201,9 +201,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 |