Unverified Commit ebbc5f90 authored by da-woods's avatar da-woods Committed by GitHub

Run ParallelRangeTransform also recursively on function arguments (GH-3608)

parent fb09adfb
......@@ -1190,6 +1190,7 @@ class ParallelRangeTransform(CythonTransform, SkipDeclarations):
def visit_CallNode(self, node):
if not self.parallel_directive:
self.visitchildren(node, exclude=('function',))
return node
# We are a parallel directive, replace this node with the
......@@ -8,6 +8,9 @@ from libc.stdlib cimport malloc, free
cdef int forward(int x) nogil:
return x
def test_parallel():
>>> test_parallel()
......@@ -20,6 +23,9 @@ def test_parallel():
with nogil, cython.parallel.parallel():
buf[threadid()] = threadid()
# Recognise threadid() also when it's used in a function argument.
# See https://github.com/cython/cython/issues/3594
buf[forward(cython.parallel.threadid())] = forward(threadid())
for i in range(maxthreads):
assert buf[i] == i
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment