STINNER Victor added the comment:

5513            idna = _PyObject_CallMethodId(hobj, &PyId_encode, "s", "idna");
5514            if (!idna)
5515                return NULL;
5516            assert(PyBytes_Check(idna));

The assertion fails because the custom string type in poc_getaddr.py returns an 
integer, not a byte string.

IMHO we should call PyUnicode_AsEncodedObject() instead of calling the encode() 
method.

----------
nosy: +haypo
title: Type confusion in socket module -> socket.getaddrinfo(host) doesn't 
ensure that host.encode() returns a byte string
versions: +Python 3.4, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24684>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to