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
Gwenaël Samain
cython
Commits
f277fa1f
Commit
f277fa1f
authored
Nov 07, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conservative fix for empty switch statements
parent
859db279
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-0
tests/run/switch.pyx
tests/run/switch.pyx
+12
-0
No files found.
Cython/Compiler/Nodes.py
View file @
f277fa1f
...
@@ -3469,6 +3469,7 @@ class SwitchStatNode(StatNode):
...
@@ -3469,6 +3469,7 @@ class SwitchStatNode(StatNode):
if
self
.
else_clause
is
not
None
:
if
self
.
else_clause
is
not
None
:
code
.
putln
(
"default:"
)
code
.
putln
(
"default:"
)
self
.
else_clause
.
generate_execution_code
(
code
)
self
.
else_clause
.
generate_execution_code
(
code
)
code
.
putln
(
"break;"
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
def
annotate
(
self
,
code
):
def
annotate
(
self
,
code
):
...
...
tests/run/switch.pyx
View file @
f277fa1f
...
@@ -89,6 +89,9 @@ __doc__ = u"""
...
@@ -89,6 +89,9 @@ __doc__ = u"""
1
1
>>> switch_off(2)
>>> switch_off(2)
0
0
>>> switch_pass(1)
1
"""
"""
def
switch_simple_py
(
x
):
def
switch_simple_py
(
x
):
...
@@ -173,3 +176,12 @@ def switch_off(int x):
...
@@ -173,3 +176,12 @@ def switch_off(int x):
else
:
else
:
return
0
return
0
return
-
1
return
-
1
def
switch_pass
(
int
x
):
if
x
==
1
:
pass
elif
x
==
2
:
pass
else
:
pass
return
x
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