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
fa08b5db
Commit
fa08b5db
authored
Oct 05, 2009
by
Craig Citro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in Cython closures branch.
parent
036a1810
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+8
-6
tests/run/closures_T82.pyx
tests/run/closures_T82.pyx
+4
-0
No files found.
Cython/Compiler/Nodes.py
View file @
fa08b5db
...
...
@@ -1181,7 +1181,7 @@ class FuncDefNode(StatNode, BlockNode):
for
entry
in
lenv
.
var_entries
:
if
lenv
.
control_flow
.
get_state
((
entry
.
name
,
'initalized'
))
is
not
True
:
entry
.
xdecref_cleanup
=
1
if
self
.
needs_closure
:
code
.
put_decref
(
Naming
.
cur_scope_cname
,
lenv
.
scope_class
.
type
)
for
entry
in
lenv
.
var_entries
:
...
...
@@ -1189,11 +1189,13 @@ class FuncDefNode(StatNode, BlockNode):
code
.
put_var_decref
(
entry
)
# Decref any increfed args
for
entry
in
lenv
.
arg_entries
:
if
(
entry
.
type
.
is_pyobject
and
not
entry
.
in_closure
and
lenv
.
control_flow
.
get_state
((
entry
.
name
,
'source'
))
!=
'arg'
):
code
.
put_var_decref
(
entry
)
if
entry
.
type
.
is_pyobject
:
src
=
lenv
.
control_flow
.
get_state
((
entry
.
name
,
'source'
))
if
entry
.
in_closure
and
src
==
'arg'
:
code
.
put_var_incref
(
entry
)
elif
not
entry
.
in_closure
and
src
!=
'arg'
:
code
.
put_var_decref
(
entry
)
# ----- Return
# This code is duplicated in ModuleNode.generate_module_init_func
if
not
lenv
.
nogil
:
...
...
tests/run/closures_T82.pyx
View file @
fa08b5db
...
...
@@ -3,6 +3,10 @@ __doc__ = u"""
>>> f(2)
5
>>> f = add_n(1000000)
>>> f(1000000), f(-1000000)
2000000, 0
>>> a(5)()
8
...
...
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