blob: 21f6e462d7bb90bd9f47df953fe3e1beae1c5a4b (
plain)
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
31
32
33
|
# mode: run
# tag: cpp, cpp17, no-cpp-locals, openmp
# no-cpp-locals because the test is already run with it explicitly set
# cython: cpp_locals=True
from cython.parallel cimport prange
cdef extern from *:
"""
class Test {
public:
Test() = delete;
Test(int v) : value(v) {}
int get_value() const { return value; }
private:
int value;
};
"""
cdef cppclass Test:
Test(int) nogil
int get_value()
def test():
"""
>>> test()
9
"""
cdef int i
for i in prange(10, nogil=True):
var = Test(i)
print(var.get_value())
|