summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-11 10:38:27 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-11 10:38:27 (GMT)
commite390410ca4cf8d52f4692e0f01ee0d48fa901435 (patch)
tree5642643397ff5cdcd13631d2a37cb50fbd8db3cd
parent25a2afdb2d8ae35091eb258126dc5c963bcf70c9 (diff)
parentf9fdfa7c4e4b5cd02f5bc23a928037d644c8cdff (diff)
downloadcpython-e390410ca4cf8d52f4692e0f01ee0d48fa901435.zip
cpython-e390410ca4cf8d52f4692e0f01ee0d48fa901435.tar.gz
cpython-e390410ca4cf8d52f4692e0f01ee0d48fa901435.tar.bz2
Merge 3.5
-rw-r--r--Misc/NEWS6
-rw-r--r--Modules/socketmodule.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 278327c..6ef23b2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -103,6 +103,12 @@ Core and Builtins
Library
-------
+- Issue #24684: socket.socket.getaddrinfo() now calls
+ PyUnicode_AsEncodedString() instead of calling the encode() method of the
+ host, to handle correctly custom string with an encode() method which doesn't
+ return a byte string. The encoder of the IDNA codec is now called directly
+ instead of calling the encode() method of the string.
+
- Issue #25060: Correctly compute stack usage of the BUILD_MAP opcode.
- Issue #24857: Comparing call_args to a long sequence now correctly returns a
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index ee24907..d9c70f8 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -5513,9 +5513,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
if (hobj == Py_None) {
hptr = NULL;
} else if (PyUnicode_Check(hobj)) {
- _Py_IDENTIFIER(encode);
-
- idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna");
+ idna = PyUnicode_AsEncodedString(hobj, "idna", NULL);
if (!idna)
return NULL;
assert(PyBytes_Check(idna));