STINNER Victor <victor.stin...@haypocalc.com> added the comment: > Here's a patch: > - those functions now accept and return str, not bytes arrays
You use UTF-8 encoding: + "Is", ni[i].if_index, ni[i].if_name); + if (!PyArg_ParseTuple(args, "s:if_nametoindex", &ifname)) You should also use the FS encoding with surrogateescape error handler: - parse arguments using "O&" format with PyUnicode_FSConverter: it gives you a PyBytes object, then use PyBytes_AS_STRING() and PyBytes_GET_SIZE() - use PyUnicode_DecodeFSDefault() to decode a byte string ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1746656> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com