We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 639b137 commit 3a37183Copy full SHA for 3a37183
1 file changed
src/scorepy/pythonHelpers.hpp
@@ -76,7 +76,11 @@ auto cast_to_PyFunc(TFunc* func) -> detail::ReplaceArgsToPyObject_t<TFunc>*
76
inline CString get_string_from_python(PyObject& o)
77
{
78
Py_ssize_t len;
79
+#if PY_MAJOR_VERSION >= 3
80
const char* s = PyUnicode_AsUTF8AndSize(&o, &len);
81
+#else
82
+ const char* s = PyString_FromStringAndSize(&o, &len);
83
+#endif
84
return CString(s, len);
85
}
86
0 commit comments