[Python-checkins] cpython (merge 3.4 -> 3.5): Merge 3.4

victor.stinner python-checkins at python.org
Fri Sep 11 12:43:07 CEST 2015


https://hg.python.org/cpython/rev/7bf325941636
changeset:   97912:7bf325941636
branch:      3.5
parent:      97909:1639f5c1ac87
parent:      97911:2bff115e6ba0
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Sep 11 12:38:17 2015 +0200
summary:
  Merge 3.4

files:
  Misc/NEWS              |  6 ++++++
  Modules/socketmodule.c |  4 +---
  2 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -14,6 +14,12 @@
 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
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -5513,9 +5513,7 @@
     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));

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list