summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 5578b13..045987c 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -198,10 +198,12 @@ class SocketIO(io.RawIOBase):
# XXX More docs
def __init__(self, sock, mode):
- if mode not in ("r", "w", "rw"):
+ if mode not in ("r", "w", "rw", "rb", "wb", "rwb"):
raise ValueError("invalid mode: %r" % mode)
io.RawIOBase.__init__(self)
self._sock = sock
+ if "b" not in mode:
+ mode += "b"
self._mode = mode
self._reading = "r" in mode
self._writing = "w" in mode