[Cython] except clause on nogil functions

mark florisson markflorisson88 at gmail.com
Sat Aug 20 00:34:17 CEST 2011


I think I found a rather serious bug: if an error label is used in a
nogil function, it tries to build a traceback. So if the GIL is
released you will immediately segfault, and otherwise it will work
fine! Here is a snippet:

cdef int with_gil_func() except 0 with gil:
    raise Exception("error!")

cdef int nogil_func() nogil except 0:

with nogil:

[0] [00:03] ~  ➤ python -c 'import test'
[1]    6888 segmentation fault  python -c 'import test'

I've tried as far back as 0.12 but all versions down to 0.12 have it.

BTW, it's really weird that the except clause on the function has to
come after nogil but before with gil, and otherwise it's a syntax

Should we fix it and do a bugfix release?

More information about the cython-devel mailing list