File: incorrectly_nested_gil_blocks.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (30 lines) | stat: -rw-r--r-- 649 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# mode: error

with gil:
    pass

with nogil:
    with nogil:
        pass

cdef void without_gil() nogil:
   # This is not an error, as 'func' *may* be called without the GIL, but it
   # may also be held.
    with nogil:
        pass

cdef void with_gil() with gil:
    # This is an error, as the GIL is acquired already
    with gil:
        pass

def func():
    with gil:
        pass

_ERRORS = u'''
3:5: Trying to acquire the GIL while it is already held.
7:9: Trying to release the GIL while it was previously released.
18:9: Trying to acquire the GIL while it is already held.
22:9: Trying to acquire the GIL while it is already held.
'''