Commit 92aaff74 authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

More refnanny fixes

parent 027a0797
......@@ -1333,6 +1333,8 @@ class NameNode(AtomicExprNode):
#print "...from", rhs ###
#print "...LHS type", self.type, "ctype", self.ctype() ###
#print "...RHS type", rhs.type, "ctype", rhs.ctype() ###
if entry.is_cglobal:
code.put_gotref(self.py_result())
if not self.lhs_of_first_assignment:
if entry.is_local and not Options.init_local_none:
initalized = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
......@@ -1342,6 +1344,8 @@ class NameNode(AtomicExprNode):
code.put_xdecref(self.result(), self.ctype())
else:
code.put_decref(self.result(), self.ctype())
if entry.is_cglobal:
code.put_giveref(rhs.py_result())
code.putln('%s = %s;' % (self.result(), rhs.result_as(self.ctype())))
if debug_disposal_code:
print("NameNode.generate_assignment_code:")
......
......@@ -1640,8 +1640,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env.use_utility_code(Nodes.traceback_utility_code)
code.putln("%s = NULL;" % Naming.retval_cname)
code.put_label(code.return_label)
code.put_finish_refcount_context(self.pos, env.qualified_name,
Naming.retval_cname, "NULL")
# Disabled because of confusion with refcount of global variables -- run ass2cglobal testcase to see
#code.put_finish_refcount_context(self.pos, env.qualified_name,
# Naming.retval_cname, "NULL")
code.putln("#if CYTHON_REFNANNY")
code.putln("if (__pyx_refchk) {};")
code.putln("#endif")
code.putln("#if PY_MAJOR_VERSION < 3")
code.putln("return;")
code.putln("#else")
......
......@@ -4170,6 +4170,8 @@ class ExceptClauseNode(Node):
exc_args = "&%s, &%s, &%s" % tuple(self.exc_vars)
code.putln("if (__Pyx_GetException(%s) < 0) %s" % (exc_args,
code.error_goto(self.pos)))
for x in self.exc_vars:
code.put_gotref(x)
if self.target:
self.exc_value.generate_evaluation_code(code)
self.target.generate_assignment_code(self.exc_value, code)
......
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