Nathaniel Flath
Nathaniel Flath

Reputation: 16015

Python backtrace from C++

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

Answers (2)

Voo
Voo

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

Useless
Useless

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?

Upvotes: 1

Related Questions