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
Boxiang Sun
cython
Commits
f288fd94
Commit
f288fd94
authored
Sep 23, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into release
parents
5fe6aef5
6260f487
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
328 additions
and
22 deletions
+328
-22
.travis.yml
.travis.yml
+1
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+14
-2
tests/run/switch.pyx
tests/run/switch.pyx
+1
-0
tests/run/switch_transform.pyx
tests/run/switch_transform.pyx
+1
-0
tests/run/test_grammar.py
tests/run/test_grammar.py
+311
-19
No files found.
.travis.yml
View file @
f288fd94
...
@@ -97,7 +97,7 @@ matrix:
...
@@ -97,7 +97,7 @@ matrix:
-
python
:
pypy3
-
python
:
pypy3
-
python
:
3.8-dev
-
python
:
3.8-dev
-
env
:
STACKLESS=true BACKEND=c PY=2
-
env
:
STACKLESS=true BACKEND=c PY=2
-
env
:
STACKLESS=true BACKEND=c PY=3
#
- env: STACKLESS=true BACKEND=c PY=3
branches
:
branches
:
only
:
only
:
...
...
Cython/Compiler/Nodes.py
View file @
f288fd94
...
@@ -6330,11 +6330,19 @@ class SwitchCaseNode(StatNode):
...
@@ -6330,11 +6330,19 @@ class SwitchCaseNode(StatNode):
child_attrs
=
[
'conditions'
,
'body'
]
child_attrs
=
[
'conditions'
,
'body'
]
def
generate_
execu
tion_code
(
self
,
code
):
def
generate_
condition_evalua
tion_code
(
self
,
code
):
for
cond
in
self
.
conditions
:
for
cond
in
self
.
conditions
:
code
.
mark_pos
(
cond
.
pos
)
cond
.
generate_evaluation_code
(
code
)
cond
.
generate_evaluation_code
(
code
)
def
generate_execution_code
(
self
,
code
):
num_conditions
=
len
(
self
.
conditions
)
line_tracing_enabled
=
code
.
globalstate
.
directives
[
'linetrace'
]
for
i
,
cond
in
enumerate
(
self
.
conditions
):
code
.
putln
(
"case %s:"
%
cond
.
result
())
code
.
putln
(
"case %s:"
%
cond
.
result
())
code
.
mark_pos
(
cond
.
pos
)
# Tracing code must appear *after* the 'case' statement.
if
line_tracing_enabled
and
i
+
1
<
num_conditions
:
# Allow fall-through after the line tracing code.
code
.
putln
(
'CYTHON_FALLTHROUGH;'
)
self
.
body
.
generate_execution_code
(
code
)
self
.
body
.
generate_execution_code
(
code
)
code
.
mark_pos
(
self
.
pos
,
trace
=
False
)
code
.
mark_pos
(
self
.
pos
,
trace
=
False
)
code
.
putln
(
"break;"
)
code
.
putln
(
"break;"
)
...
@@ -6361,6 +6369,10 @@ class SwitchStatNode(StatNode):
...
@@ -6361,6 +6369,10 @@ class SwitchStatNode(StatNode):
def
generate_execution_code
(
self
,
code
):
def
generate_execution_code
(
self
,
code
):
self
.
test
.
generate_evaluation_code
(
code
)
self
.
test
.
generate_evaluation_code
(
code
)
# Make sure all conditions are evaluated before going into the switch() statement.
# This is required in order to prevent any execution code from leaking into the space between the cases.
for
case
in
self
.
cases
:
case
.
generate_condition_evaluation_code
(
code
)
code
.
mark_pos
(
self
.
pos
)
code
.
mark_pos
(
self
.
pos
)
code
.
putln
(
"switch (%s) {"
%
self
.
test
.
result
())
code
.
putln
(
"switch (%s) {"
%
self
.
test
.
result
())
for
case
in
self
.
cases
:
for
case
in
self
.
cases
:
...
...
tests/run/switch.pyx
View file @
f288fd94
# mode: run
# mode: run
# cython: linetrace=True
cimport
cython
cimport
cython
...
...
tests/run/switch_transform.pyx
View file @
f288fd94
# cython: optimize.use_switch=False
# cython: optimize.use_switch=False
# cython: linetrace=True
cdef
extern
from
*
:
cdef
extern
from
*
:
enum
:
enum
:
...
...
tests/run/test_grammar.py
View file @
f288fd94
This diff is collapsed.
Click to expand it.
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