summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-11-22 00:41:45 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-11-22 00:41:45 (GMT)
commit44309e6b3768d6d559491ddf6ca56bfad2adb9b5 (patch)
tree5d71526f8d1b06a39c67191bf55e85e68c205c95 /Lib/socket.py
parent656aa28cd50d00171d46df30eaeecd45eb0ae32c (diff)
downloadcpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.zip
cpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.tar.gz
cpython-44309e6b3768d6d559491ddf6ca56bfad2adb9b5.tar.bz2
make FileIO.mode always include 'b'
#4386 Reviewed by Amaury
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