13 #ifndef ROOTUTILS_PYGETSTRING_H
14 #define ROOTUTILS_PYGETSTRING_H
16 #ifdef _POSIX_C_SOURCE
17 # undef _POSIX_C_SOURCE
42 const char* cstr = PyUnicode_AsUTF8AndSize (
s,
nullptr);
43 if (!cstr && PyBytes_Check (
s)) {
45 cstr = PyBytes_AsString (
s);
48 return std::make_pair (std::string (cstr),
true);
50 return std::make_pair (std::string(),
false);
57 #endif // not ROOTUTILS_PYGETSTRING_H