This repository was archived by the owner on May 3, 2024. It is now read-only.
This repository was archived by the owner on May 3, 2024. It is now read-only.
Additional python debug output on missing __dict__ #66
Closed
Description
When working on LDMX-sw, it isn't uncommon to break your python configuration files. One of the most annoying to debug is the missing dict one. I think it would be good to print a repr of the PyObject*
before throwing the exception (or include the repr in the exception message).
Taking inspiration from the existing getPyString
, something equivalent to
static void pretty_print(PyObject* object) {
PyObject* repr = PyObject_Repr(object); // Get string representation
if (repr != nullptr) {
const char* str = PyUnicode_AsUTF8(repr);
if (str != nullptr) {
std::cout << "Python object: " << str
<< std::endl;
}
Py_XDECREF(repr);
}
}
should probably do the trick
Metadata
Metadata
Assignees
Labels
No labels