You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The document of Python3 says:
wchar_t* PyUnicode_AsWideCharString(PyObject *unicode, Py_ssize_t *size)
Returns a buffer allocated by PyMem_Alloc() (use PyMem_Free() to free it) on success.
and in cast.h of pybind11:
template <> class type_casterstd::wstring
It looks like a bug, but it's no longer used in the pybind11 master branch (as of PR #624, which largely rewrote the unicode support). We now go via PyUnicode_AsEncodedString, and manage the returned reference.
The document of Python3 says:
wchar_t* PyUnicode_AsWideCharString(PyObject *unicode, Py_ssize_t *size)
Returns a buffer allocated by PyMem_Alloc() (use PyMem_Free() to free it) on success.
and in cast.h of pybind11:
template <> class type_casterstd::wstring
Why we don't need to call PyMem_Free to free the buffer in this case?
The text was updated successfully, but these errors were encountered: