Commit 1adf6cc7 authored by Stefan Behnel's avatar Stefan Behnel

fix reference leak in closure when reassigning to "*args" argument

parent d42a4d7d
...@@ -1915,7 +1915,7 @@ class FuncDefNode(StatNode, BlockNode): ...@@ -1915,7 +1915,7 @@ class FuncDefNode(StatNode, BlockNode):
elif is_cdef and entry.type.is_memoryviewslice and len(entry.cf_assignments) > 1: elif is_cdef and entry.type.is_memoryviewslice and len(entry.cf_assignments) > 1:
code.put_incref_memoryviewslice(entry.cname, have_gil=code.funcstate.gil_owned) code.put_incref_memoryviewslice(entry.cname, have_gil=code.funcstate.gil_owned)
for entry in lenv.var_entries: for entry in lenv.var_entries:
if entry.is_arg and len(entry.cf_assignments) > 1: if entry.is_arg and len(entry.cf_assignments) > 1 and not entry.in_closure:
if entry.xdecref_cleanup: if entry.xdecref_cleanup:
code.put_var_xincref(entry) code.put_var_xincref(entry)
else: else:
......
# mode: run
# tag: closure
def reassign_args(x, *args):
"""
>>> reassign_args(1, [1,2,3,4])
"""
a,args = args[0], args[1:]
b = False
if b:
c = x.map_coefficients(lambda c: c(*args))
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