Will
Will

Reputation: 4621

Propagating embedded Python Exceptions up to C++

If I have C++ code with embedded Python functions, i.e. it uses Python's C API to call Python's interpreter, how can I get Python exceptions to bubble up to the C++ level?


Note: This is not the inverse question (about propagating C++ extension exceptions up to the Python intepreter).

Upvotes: 6

Views: 1759

Answers (1)

amwinter
amwinter

Reputation: 3139

https://docs.python.org/2/c-api/exceptions.html

specifically, PyErr_PrintEx(0) -- this will print a traceback.

Upvotes: 1

Related Questions