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.
This commit is contained in:
parent
db4220ea09
commit
ec1a498a01
|
@ -81,6 +81,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 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.
|
||||||
|
|
||||||
|
|
|
@ -5213,9 +5213,7 @@ socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
|
||||||
if (hobj == Py_None) {
|
if (hobj == Py_None) {
|
||||||
hptr = NULL;
|
hptr = NULL;
|
||||||
} else if (PyUnicode_Check(hobj)) {
|
} else if (PyUnicode_Check(hobj)) {
|
||||||
_Py_IDENTIFIER(encode);
|
idna = PyUnicode_AsEncodedString(hobj, "idna", NULL);
|
||||||
|
|
||||||
idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna");
|
|
||||||
if (!idna)
|
if (!idna)
|
||||||
return NULL;
|
return NULL;
|
||||||
assert(PyBytes_Check(idna));
|
assert(PyBytes_Check(idna));
|
||||||
|
|
Loading…
Reference in New Issue