Commit 4346de41 authored by Xavier Thompson's avatar Xavier Thompson

Fix missing decref for cypclass args converted from Python

parent 8ce7c6d5
......@@ -3671,6 +3671,15 @@ class DefNodeWrapper(FuncDefNode):
code.put_var_xdecref(entry)
else:
code.put_var_decref(entry)
elif entry.is_arg and entry.type.is_cyp_class:
# The conversion from PyObject to CyObject creates a new CyObject reference.
code.put_cyxdecref(entry.cname)
for entry in lenv.arg_entries:
if entry.type.is_cyp_class:
# The conversion from PyObject to CyObject creates a new CyObject reference.
# Such a conversion occurs even when the argument is not explicitly marked
# as needing a conversion and declared as a variable in var_entries.
code.put_cyxdecref(entry.cname)
code.put_finish_refcount_context()
if not self.return_type.is_void:
......
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