Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate C++ expections in Python (again) #1700

Open
heinezen opened this issue Oct 15, 2024 · 0 comments
Open

Propagate C++ expections in Python (again) #1700

heinezen opened this issue Oct 15, 2024 · 0 comments
Labels
bugfix Restores intended behavior improvement Enhancement of an existing component lang: cython Implemented using Cython code

Comments

@heinezen
Copy link
Member

Problem Description

In #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 #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:

  1. Print the C++ exception backtrace in the C++ code, then forward the exception to Python and raise a Python exception
  2. Forward the C++ message to Python and include it in the Python exception message (this was proposed in Make _PyTraceback_Add public python/cpython#68931 (comment))
  3. Do not forward C++ exceptions to Python and simply terminate in C++.
@heinezen heinezen added improvement Enhancement of an existing component bugfix Restores intended behavior lang: cython Implemented using Cython code labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Restores intended behavior improvement Enhancement of an existing component lang: cython Implemented using Cython code
Projects
None yet
Development

No branches or pull requests

1 participant