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
5827f4c9
Commit
5827f4c9
authored
Nov 30, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix refnanny code for del statement inside of generators
parent
37724ccc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+2
-0
tests/run/generators_py.py
tests/run/generators_py.py
+12
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
5827f4c9
...
...
@@ -1861,6 +1861,8 @@ class NameNode(AtomicExprNode):
code
.
put_error_if_unbound
(
self
.
pos
,
self
.
entry
)
if
self
.
entry
.
type
.
is_pyobject
:
if
self
.
entry
.
in_closure
:
code
.
put_gotref
(
self
.
result
())
# generator
code
.
put_decref
(
self
.
result
(),
self
.
ctype
())
code
.
putln
(
'%s = NULL;'
%
self
.
result
())
else
:
...
...
tests/run/generators_py.py
View file @
5827f4c9
...
...
@@ -350,3 +350,15 @@ def test_generator_cleanup():
yield
1
finally
:
print
(
'cleanup'
)
def
test_del_in_generator
():
"""
>>> [ s for s in test_del_in_generator() ]
['abcabcabc', 'abcabcabc']
"""
x
=
len
(
'abc'
)
*
'abc'
a
=
x
yield
x
del
x
yield
a
del
a
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