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
a5b3d89b
Commit
a5b3d89b
authored
May 06, 2011
by
scoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #32 from vitek/unreachable_fix
fix for unreachable yield in generators
parents
109185f0
019551db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+0
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+3
-0
tests/run/unreachable.pyx
tests/run/unreachable.pyx
+11
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
a5b3d89b
...
@@ -5253,7 +5253,6 @@ class YieldExprNode(ExprNode):
...
@@ -5253,7 +5253,6 @@ class YieldExprNode(ExprNode):
self
.
arg
.
analyse_types
(
env
)
self
.
arg
.
analyse_types
(
env
)
if
not
self
.
arg
.
type
.
is_pyobject
:
if
not
self
.
arg
.
type
.
is_pyobject
:
self
.
arg
=
self
.
arg
.
coerce_to_pyobject
(
env
)
self
.
arg
=
self
.
arg
.
coerce_to_pyobject
(
env
)
env
.
use_utility_code
(
generator_utility_code
)
def
generate_evaluation_code
(
self
,
code
):
def
generate_evaluation_code
(
self
,
code
):
self
.
label_name
=
code
.
new_label
(
'resume_from_yield'
)
self
.
label_name
=
code
.
new_label
(
'resume_from_yield'
)
...
...
Cython/Compiler/Nodes.py
View file @
a5b3d89b
...
@@ -2989,6 +2989,9 @@ class GeneratorDefNode(DefNode):
...
@@ -2989,6 +2989,9 @@ class GeneratorDefNode(DefNode):
code
.
putln
(
"return (PyObject *) %s;"
%
Naming
.
cur_scope_cname
);
code
.
putln
(
"return (PyObject *) %s;"
%
Naming
.
cur_scope_cname
);
def
generate_function_definitions
(
self
,
env
,
code
):
def
generate_function_definitions
(
self
,
env
,
code
):
from
ExprNodes
import
generator_utility_code
env
.
use_utility_code
(
generator_utility_code
)
self
.
gbody
.
generate_function_header
(
code
,
proto
=
True
)
self
.
gbody
.
generate_function_header
(
code
,
proto
=
True
)
super
(
GeneratorDefNode
,
self
).
generate_function_definitions
(
env
,
code
)
super
(
GeneratorDefNode
,
self
).
generate_function_definitions
(
env
,
code
)
self
.
gbody
.
generate_function_definitions
(
env
,
code
)
self
.
gbody
.
generate_function_definitions
(
env
,
code
)
...
...
tests/run/unreachable.pyx
0 → 100644
View file @
a5b3d89b
# mode: run
# tag: generators unreachable
def
with_yield_removed
():
"""
>>> o = with_yield_removed()
>>> list(o)
[]
"""
return
yield
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