Skip to content

Commit

Permalink
Add a version specific const cast to PyUnicode_AsUTF8AndSize.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsorby committed Mar 17, 2019
1 parent 0621063 commit 1dab202
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bindings/interface/pyzincstringhandling.i
Expand Up @@ -45,10 +45,14 @@ free($1);
PyObject *utf8_obj = PyUnicode_AsUTF8String($input);
$1 = PyString_AsString(utf8_obj);
$2 = PyString_Size(utf8_obj);
%#else
%#elif PY_VERSION_HEX < 0x03070000
Py_ssize_t len = 0;
$1 = PyUnicode_AsUTF8AndSize($input, &len);
$2 = (int)len;
%#else
Py_ssize_t len = 0;
$1 = const_cast<char *>(PyUnicode_AsUTF8AndSize($input, &len));
$2 = (int)len;
%#endif
}
else
Expand Down

0 comments on commit 1dab202

Please sign in to comment.