Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
92f57792
Commit
92f57792
authored
Oct 26, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
Conflicts: CHANGES.rst
parents
f2cf0b6e
412b5227
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
CHANGES.rst
CHANGES.rst
+10
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
tests/run/sequential_parallel.pyx
tests/run/sequential_parallel.pyx
+28
-0
No files found.
CHANGES.rst
View file @
92f57792
...
@@ -59,6 +59,16 @@ Other changes
...
@@ -59,6 +59,16 @@ Other changes
-------------
-------------
0.23.5 (2015-xx-yy)
===================
Bugs fixed
----------
* Fix prange() to behave identically to range(). The end condition was
miscalculated when the range was not exactly divisible by the step.
0.23.4 (2015-10-10)
0.23.4 (2015-10-10)
===================
===================
...
...
Cython/Compiler/Nodes.py
View file @
92f57792
...
@@ -8560,7 +8560,7 @@ class ParallelRangeNode(ParallelStatNode):
...
@@ -8560,7 +8560,7 @@ class ParallelRangeNode(ParallelStatNode):
self
.
control_flow_var_code_point
=
code
.
insertion_point
()
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;"
%
fmt_dict
)
code
.
putln
(
"%(nsteps)s = (%(stop)s - %(start)s
+ %(step)s - %(step)s/abs(%(step)s)
) / %(step)s;"
%
fmt_dict
)
# The target iteration variable might not be initialized, do it only if
# The target iteration variable might not be initialized, do it only if
# we are executing at least 1 iteration, otherwise we should leave the
# we are executing at least 1 iteration, otherwise we should leave the
...
...
tests/run/sequential_parallel.pyx
View file @
92f57792
...
@@ -46,6 +46,34 @@ def test_descending_prange():
...
@@ -46,6 +46,34 @@ def test_descending_prange():
return
sum
return
sum
def
test_prange_matches_range
(
int
start
,
int
stop
,
int
step
):
"""
>>> test_prange_matches_range(0, 8, 3)
>>> test_prange_matches_range(0, 9, 3)
>>> test_prange_matches_range(0, 10, 3)
>>> test_prange_matches_range(0, 10, -3)
>>> test_prange_matches_range(0, -10, -3)
>>> test_prange_matches_range(1, -10, -3)
>>> test_prange_matches_range(2, -10, -3)
>>> test_prange_matches_range(3, -10, -3)
"""
cdef
int
i
,
range_last
,
prange_last
prange_set
=
set
()
for
i
in
prange
(
start
,
stop
,
step
,
nogil
=
True
,
num_threads
=
3
):
prange_last
=
i
with
gil
:
prange_set
.
add
(
i
)
range_set
=
set
(
range
(
start
,
stop
,
step
))
assert
range_set
==
prange_set
,
"missing: %s extra %s"
%
(
sorted
(
range_set
-
prange_set
),
sorted
(
prange_set
-
range_set
))
for
ii
in
range
(
start
,
stop
,
step
):
range_last
=
ii
if
range_set
:
assert
prange_last
==
i
assert
range_last
==
prange_last
def
test_propagation
():
def
test_propagation
():
"""
"""
>>> test_propagation()
>>> test_propagation()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment