summaryrefslogtreecommitdiff
path: root/tests/run/trace_nogil.pyx
blob: 175935cedfdfb67f9ade6e81d9203ba2ae55eb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# cython: linetrace=True

cdef void foo(int err) except * nogil:
    with gil:
        raise ValueError(err)


# Test from gh-4637
def handler(int err):
    """
    >>> handler(0)
    All good
    >>> handler(1)    # doctest: +ELLIPSIS
    Traceback (most recent call last):
        ...
    ValueError: 1
    """
    if (err % 2):
        with nogil:
            foo(err)
    else:
        print("All good")