inline char * get_string(PyObject * uniobj) { |
// TODO: re-evalutate if utf8 is always appropriate here. |
PyObject *strobj = PyUnicode_AsEncodedString(uniobj, "UTF-8", "strict"); |
if (!strobj) return NULL; |
Py_INCREF(strobj); |
return PyBytes_AS_STRING(strobj); |
} |
when PyUnicodeUCS4_AsEncodedString() succeeds
'*strobj' was allocated at: PyObject *strobj = PyUnicode_AsEncodedString(uniobj, "UTF-8", "strict");
taking False path
was expecting final owned ob_refcnt of '*strobj' to be 0 since nothing references it but final ob_refcnt is refs: 2 owned