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.
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
for directories (including empty directories) in ZIP file.
if (hobj == Py_None) {
hptr = NULL;
} else if (PyUnicode_Check(hobj)) {
- idna = PyObject_CallMethod(hobj, "encode", "s", "idna");
+ idna = PyUnicode_AsEncodedString(hobj, "idna", NULL);
if (!idna)
return NULL;
hptr = PyString_AsString(idna);