Kaydet (Commit) 9a2326b3 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #24684: socket.socket.getaddrinfo() now calls

PyUnicode_AsEncodedString() instead of calling the encode() method of the
host, to handle correctly custom unicode 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.
üst 6f80464f
...@@ -37,6 +37,12 @@ Core and Builtins ...@@ -37,6 +37,12 @@ Core and Builtins
Library Library
------- -------
- Issue #24684: socket.socket.getaddrinfo() now calls
PyUnicode_AsEncodedString() instead of calling the encode() method of the
host, to handle correctly custom unicode 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 #24982: shutil.make_archive() with the "zip" format now adds entries - Issue #24982: shutil.make_archive() with the "zip" format now adds entries
for directories (including empty directories) in ZIP file. for directories (including empty directories) in ZIP file.
......
...@@ -4158,7 +4158,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args) ...@@ -4158,7 +4158,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args)
if (hobj == Py_None) { if (hobj == Py_None) {
hptr = NULL; hptr = NULL;
} else if (PyUnicode_Check(hobj)) { } else if (PyUnicode_Check(hobj)) {
idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); idna = PyUnicode_AsEncodedString(hobj, "idna", NULL);
if (!idna) if (!idna)
return NULL; return NULL;
hptr = PyString_AsString(idna); hptr = PyString_AsString(idna);
......
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