diff Lib/socket.py @ 65258:1875bfed5689

Issue #10041: The signature of optional arguments in socket.makefile() didn't match that of io.open(), and they also didn't get forwarded properly to TextIOWrapper in text mode. Patch by Kai Zhu.
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 13 Oct 2010 16:17:14 +0000
parents f3dcb314c3e3
children cff78ffb932a
line wrap: on
line diff
--- a/Lib/socket.py	Wed Oct 13 13:23:20 2010 +0000
+++ b/Lib/socket.py	Wed Oct 13 16:17:14 2010 +0000
@@ -133,7 +133,7 @@
         return socket(self.family, self.type, self.proto, fileno=fd), addr
 
     def makefile(self, mode="r", buffering=None, *,
-                 encoding=None, newline=None):
+                 encoding=None, errors=None, newline=None):
         """makefile(...) -> an I/O stream connected to the socket
 
         The arguments are as for io.open() after the filename,
@@ -171,7 +171,7 @@
             buffer = io.BufferedWriter(raw, buffering)
         if binary:
             return buffer
-        text = io.TextIOWrapper(buffer, encoding, newline)
+        text = io.TextIOWrapper(buffer, encoding, errors, newline)
         text.mode = mode
         return text