Commit 9423a65f authored by Stefan Behnel's avatar Stefan Behnel

fix refnanny for closure variable assignments

parent b6877b77
......@@ -1206,6 +1206,8 @@ class NameNode(AtomicExprNode):
if entry.is_cglobal:
code.put_giveref(rhs.py_result())
code.putln('%s = %s;' % (self.result(), rhs.result_as(self.ctype())))
if self.type.is_pyobject and self.entry.in_closure:
code.put_giveref(self.result())
if debug_disposal_code:
print("NameNode.generate_assignment_code:")
print("...generating post-assignment code for %s" % rhs)
......
......@@ -73,13 +73,13 @@ def inner_override(a,b):
def reassign(x):
def f(a):
return a+x
x = 1 # currently lacks a GIVEREF()
x = 1
return f
def reassign_int(x):
def f(int a):
return a+x
x = 1 # currently lacks a GIVEREF()
x = 1
return f
def reassign_int_int(int x):
......@@ -100,15 +100,15 @@ def cy_twofuncs(x):
def more_inner_funcs(x):
# pretty ugly segfault
def f(a): # this lacks a GIVEREF()
def f(a):
def g(b):
return a+b+x
return g
def g(b): # this lacks a GIVEREF()
def g(b):
def f(a):
return a+b+x
return f
def h(b): # this lacks a GIVEREF()
def h(b):
def f(a):
return a+b+x
return f
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment