static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, uint16_t *dest_port)
{
- if (PyStr_Check(obj)) {
+ if (PyStr_Check(obj) || PyUnicode_Check(obj)) {
*dest_addr = PyStr_AsString(obj);
*dest_port = NBT_NAME_SERVICE_PORT;
return true;
return false;
}
- if (!PyStr_Check(PyTuple_GetItem(obj, 0))) {
+ if (!(PyStr_Check(PyTuple_GetItem(obj, 0)) || PyUnicode_Check(PyTuple_GetItem(obj, 0)))) {
PyErr_SetString(PyExc_TypeError, "Destination tuple first element not string");
return false;
}
}
}
- if (PyStr_Check(obj)) {
+ if (PyStr_Check(obj) || PyUnicode_Check(obj)) {
/* FIXME: Parse string to be able to interpret things like RHONWYN<02> ? */
name->name = PyStr_AsString(obj);
name->scope = NULL;