Commit 834bd81c authored by Antoine Pitrou's avatar Antoine Pitrou

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.
parent f2b1909e
...@@ -613,7 +613,7 @@ correspond to Unix system calls applicable to sockets. ...@@ -613,7 +613,7 @@ correspond to Unix system calls applicable to sockets.
is system-dependent (usually 5). is system-dependent (usually 5).
.. method:: socket.makefile(mode='r', buffering=None, *, encoding=None, newline=None) .. method:: socket.makefile(mode='r', buffering=None, *, encoding=None, errors=None, newline=None)
.. index:: single: I/O control; buffering .. index:: single: I/O control; buffering
......
...@@ -133,7 +133,7 @@ class socket(_socket.socket): ...@@ -133,7 +133,7 @@ class socket(_socket.socket):
return socket(self.family, self.type, self.proto, fileno=fd), addr return socket(self.family, self.type, self.proto, fileno=fd), addr
def makefile(self, mode="r", buffering=None, *, 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 """makefile(...) -> an I/O stream connected to the socket
The arguments are as for io.open() after the filename, The arguments are as for io.open() after the filename,
...@@ -171,7 +171,7 @@ class socket(_socket.socket): ...@@ -171,7 +171,7 @@ class socket(_socket.socket):
buffer = io.BufferedWriter(raw, buffering) buffer = io.BufferedWriter(raw, buffering)
if binary: if binary:
return buffer return buffer
text = io.TextIOWrapper(buffer, encoding, newline) text = io.TextIOWrapper(buffer, encoding, errors, newline)
text.mode = mode text.mode = mode
return text return text
......
This diff is collapsed.
...@@ -920,5 +920,6 @@ Artur Zaprzala ...@@ -920,5 +920,6 @@ Artur Zaprzala
Mike Zarnstorff Mike Zarnstorff
Siebren van der Zee Siebren van der Zee
Uwe Zessin Uwe Zessin
Kai Zhu
Tarek Ziadé Tarek Ziadé
Peter Åstrand Peter Åstrand
...@@ -13,6 +13,10 @@ Core and Builtins ...@@ -13,6 +13,10 @@ Core and Builtins
Library Library
------- -------
- 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.
- Issue #9003: http.client.HTTPSConnection, urllib.request.HTTPSHandler and - Issue #9003: http.client.HTTPSConnection, urllib.request.HTTPSHandler and
urllib.request.urlopen now take optional arguments to allow for urllib.request.urlopen now take optional arguments to allow for
server certificate checking, as recommended in public uses of HTTPS. server certificate checking, as recommended in public uses of HTTPS.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment