Skip to content

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

Open
@heinezen

Description

@heinezen

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++.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixRestores intended behaviorimprovementEnhancement of an existing componentlang: cythonImplemented using Cython code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions