diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-19 10:34:07 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-11-19 10:34:07 (GMT) |
commit | a9568bb44a8f955a1194a91de31dc29e0e4fe7c8 (patch) | |
tree | b088c38c2b6b9689ab2c6613554fd8c5d201ed7f /Lib/socket.py | |
parent | 1d922d0ce92a95437616a3793c6068b51ec72a5d (diff) | |
parent | fca2fc090c8227e8693a2b53dcdafd80bef06c1f (diff) | |
download | cpython-a9568bb44a8f955a1194a91de31dc29e0e4fe7c8.zip cpython-a9568bb44a8f955a1194a91de31dc29e0e4fe7c8.tar.gz cpython-a9568bb44a8f955a1194a91de31dc29e0e4fe7c8.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 a7cba9a..7dc8ef0 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -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 |