Skip to content

Error when using nogil in cpdef function that has nogil in signature #4137

@vladima

Description

@vladima

Code below used to compile in 0.29.21 but fails on master with error

cpdef void test(const int i) nogil:
with nogil, parallel(num_threads=i):
^
main.pyx:4:9: Trying to release the GIL while it was previously released.

from cython.parallel import parallel

cpdef void test(const int i) nogil:
    with nogil, parallel(num_threads=i):
        pass

The documentation for nogil states:

The function does not in itself release the GIL if it is held by the caller.

So the error looks like a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions