Propagate C++ expections in Python (again)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Problem Description
In https://github.com/SFTtech/openage/pull/1697 we removed the old method for adding C++ backtraces to Python, since Python's _PyTraceback_Add is no longer part of the public API.
An even older solution that we used before https://github.com/SFTtech/openage/pull/1496 also doesn't work anymore. We should find a better way to propagate backtraces that do not depend on unstable Python features.
Solutions?
We could solve this in several ways:
- Print the C++ exception backtrace in the C++ code, then forward the exception to Python and raise a Python exception
- Forward the C++ message to Python and include it in the Python exception message (this was proposed in https://github.com/python/cpython/issues/68931#issuecomment-1093689102)
- Do not forward C++ exceptions to Python and simply terminate in C++.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing pull requests 1697 and 1496 to understand the removed and older approaches, then read the linked CPython issue discussion. The work is done when a stable approach for propagating C++ backtraces or messages to Python is selected and implemented without relying on unstable Python features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100