We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 132d21c commit 8556089Copy full SHA for 8556089
src/scorepy/pythonHelpers.hpp
@@ -75,9 +75,14 @@ auto cast_to_PyFunc(TFunc* func) -> detail::ReplaceArgsToPyObject_t<TFunc>*
75
76
inline CString get_string_from_python(PyObject& o)
77
{
78
+#if PY_MAJOR_VERSION >= 3
79
Py_ssize_t len;
80
const char* s = PyUnicode_AsUTF8AndSize(&o, &len);
81
return CString(s, len);
82
+#else
83
+ const char* s = PyString_AsString(&o);
84
+ return CString(s);
85
+#endif
86
}
87
88
/// Pair of a C-String and it's length useful for PyArg_ParseTuple with 's#'
0 commit comments