Commit 2271a955 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents 0ed473f9 a9154cf7
...@@ -92,6 +92,13 @@ Other changes ...@@ -92,6 +92,13 @@ Other changes
* Support for Python 2.6 was removed. * Support for Python 2.6 was removed.
0.29.5 (2019-??-??)
===================
* Compiler crash when `prange()` loops appear inside of with-statements.
(Github issue #2780)
0.29.4 (2019-02-01) 0.29.4 (2019-02-01)
=================== ===================
......
...@@ -8467,9 +8467,10 @@ class ParallelStatNode(StatNode, ParallelNode): ...@@ -8467,9 +8467,10 @@ class ParallelStatNode(StatNode, ParallelNode):
Make any used temporaries private. Before the relevant code block Make any used temporaries private. Before the relevant code block
code.start_collecting_temps() should have been called. code.start_collecting_temps() should have been called.
""" """
if self.is_parallel:
c = self.privatization_insertion_point c = self.privatization_insertion_point
self.privatization_insertion_point = None
if self.is_parallel:
self.temps = temps = code.funcstate.stop_collecting_temps() self.temps = temps = code.funcstate.stop_collecting_temps()
privates, firstprivates = [], [] privates, firstprivates = [], []
for temp, type in sorted(temps): for temp, type in sorted(temps):
...@@ -8560,8 +8561,10 @@ class ParallelStatNode(StatNode, ParallelNode): ...@@ -8560,8 +8561,10 @@ class ParallelStatNode(StatNode, ParallelNode):
If compiled without OpenMP support (at the C level), then we still have If compiled without OpenMP support (at the C level), then we still have
to acquire the GIL to decref any object temporaries. to acquire the GIL to decref any object temporaries.
""" """
if self.error_label_used:
begin_code = self.begin_of_parallel_block begin_code = self.begin_of_parallel_block
self.begin_of_parallel_block = None
if self.error_label_used:
end_code = code end_code = code
begin_code.putln("#ifdef _OPENMP") begin_code.putln("#ifdef _OPENMP")
...@@ -8774,6 +8777,8 @@ class ParallelStatNode(StatNode, ParallelNode): ...@@ -8774,6 +8777,8 @@ class ParallelStatNode(StatNode, ParallelNode):
the for loop. the for loop.
""" """
c = self.begin_of_parallel_control_block_point c = self.begin_of_parallel_control_block_point
self.begin_of_parallel_control_block_point = None
self.begin_of_parallel_control_block_point_after_decls = None
# Firstly, always prefer errors over returning, continue or break # Firstly, always prefer errors over returning, continue or break
if self.error_label_used: if self.error_label_used:
...@@ -9124,8 +9129,6 @@ class ParallelRangeNode(ParallelStatNode): ...@@ -9124,8 +9129,6 @@ class ParallelRangeNode(ParallelStatNode):
self.setup_parallel_control_flow_block(code) # parallel control flow block self.setup_parallel_control_flow_block(code) # parallel control flow block
self.control_flow_var_code_point = code.insertion_point()
# Note: nsteps is private in an outer scope if present # Note: nsteps is private in an outer scope if present
code.putln("%(nsteps)s = (%(stop)s - %(start)s + %(step)s - %(step)s/abs(%(step)s)) / %(step)s;" % fmt_dict) code.putln("%(nsteps)s = (%(stop)s - %(start)s + %(step)s - %(step)s/abs(%(step)s)) / %(step)s;" % fmt_dict)
......
...@@ -754,3 +754,19 @@ def test_pointer_temps(double x): ...@@ -754,3 +754,19 @@ def test_pointer_temps(double x):
f = &arr[0] f = &arr[0]
return f[0] return f[0]
def test_prange_in_with(int x, ctx):
"""
>>> from contextlib import contextmanager
>>> @contextmanager
... def ctx(l): yield l
>>> test_prange_in_with(4, ctx([0]))
6
"""
cdef int i
with ctx as l:
for i in prange(x, nogil=True):
with gil:
l[0] += i
return l[0]
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