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

Comments

Projects
None yet
2 participants
@godlygeek

godlygeek commented Sep 12, 2018

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

This comment has been minimized.

Show comment
Hide comment
@robertwb

robertwb Sep 13, 2018

Contributor
Contributor

robertwb commented Sep 13, 2018

@robertwb robertwb closed this in #2610 Sep 17, 2018

robertwb pushed a commit that referenced this issue Sep 17, 2018

robertwb added a commit that referenced this issue Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment