| 27 | }; |
| 28 | |
| 29 | std::string pyobj_to_string(PyObject* obj) { |
| 30 | if (!obj) |
| 31 | return ""; |
| 32 | PyObjectGuard str(PyObject_Str(obj)); |
| 33 | if (!str) |
| 34 | return ""; |
| 35 | const char* c_str = PyUnicode_AsUTF8(str.get()); |
| 36 | return c_str ? c_str : ""; |
| 37 | } |
| 38 | |
| 39 | void print_python_error() { |
| 40 | if (PyErr_Occurred()) { |
no test coverage detected