summaryrefslogtreecommitdiff
path: root/tests/run/trace_nogil.pyx
blob: dee443e5b2689e9279797496b19640e1ba104fd4 (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) nogil except *:
    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")