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

Python exceptions can't propagate from an "except +" function #2603

Closed
godlygeek opened this issue Sep 12, 2018 · 1 comment · Fixed by #2610
Closed

Python exceptions can't propagate from an "except +" function #2603

godlygeek opened this issue Sep 12, 2018 · 1 comment · Fixed by #2610

Comments

@godlygeek
Copy link

I couldn't find an existing issue for this; hopefully I didn't miss one.

Given this code in test.pyx

# distutils: language = c++

cdef func() except +:
    raise NotImplementedError()

def call_func():
    func()

the interpreter will segfault if you call test.call_func(). This appears to be caused by Cython disabling all other exception handling if except + is specified, including the check for whether NULL was returned after a Python exception was set.

My expectation was that I could use the except + to handle truly unexpected things like std::bad_alloc, while explicitly raising Python exceptions for less exceptional exceptions.

@robertwb
Copy link
Contributor

robertwb commented Sep 13, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants