Reputation: 16015
I have some Python code that calls into C++. Is there a way to retrieve the Python backtrace and not just the C++ one from a point inside the C++ code?
Upvotes: 3
Views: 306
Reputation: 30216
I don't think there's any inherent way to do so, but why not just get the stacktrace from pythoncode?
It's pretty simple to call python from C++ and there's the handy traceback module for this stuff.
Upvotes: 0
Reputation: 67733
I think the magic word you're looking for is traceback.
If you know you're looking for traceback.extract_stack(), can you figure out the API calls yourself?
traceback.extract_stack()
Upvotes: 1