summaryrefslogtreecommitdiff
path: root/tests/run/cpp_locals_parallel.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/cpp_locals_parallel.pyx')
-rw-r--r--tests/run/cpp_locals_parallel.pyx33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/run/cpp_locals_parallel.pyx b/tests/run/cpp_locals_parallel.pyx
new file mode 100644
index 000000000..21f6e462d
--- /dev/null
+++ b/tests/run/cpp_locals_parallel.pyx
@@ -0,0 +1,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())