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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
1c4d20b8
Commit
1c4d20b8
authored
Dec 14, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix first assignments to closure variables
parent
22b15039
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-2
tests/run/generators.pyx
tests/run/generators.pyx
+16
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
1c4d20b8
...
...
@@ -1619,9 +1619,9 @@ class NameNode(AtomicExprNode):
if
self
.
use_managed_ref
:
rhs
.
make_owned_reference
(
code
)
is_external_ref
=
entry
.
is_cglobal
or
self
.
entry
.
in_closure
or
self
.
entry
.
from_closure
if
is_external_ref
:
code
.
put_gotref
(
self
.
py_result
())
if
not
self
.
lhs_of_first_assignment
:
if
is_external_ref
:
code
.
put_gotref
(
self
.
py_result
())
if
entry
.
is_local
and
not
Options
.
init_local_none
:
initialized
=
entry
.
scope
.
control_flow
.
get_state
((
entry
.
name
,
'initialized'
),
self
.
pos
)
if
initialized
is
True
:
...
...
tests/run/generators.pyx
View file @
1c4d20b8
...
...
@@ -148,6 +148,22 @@ def check_throw():
except
ValueError
:
pass
def
test_first_assignment
():
"""
>>> gen = test_first_assignment()
>>> next(gen)
5
>>> next(gen)
10
>>> next(gen)
(5, 10)
"""
cdef
x
=
5
# first
yield
x
cdef
y
=
10
# first
yield
y
yield
(
x
,
y
)
class
Foo
(
object
):
"""
...
...
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