Commit f0fb0efa authored by Xavier Thompson's avatar Xavier Thompson

Fix cypclass refcounting during exception cleanup

parent eebbd5d0
......@@ -849,10 +849,12 @@ class FunctionState(object):
elif type.is_cfunction:
from . import PyrexTypes
type = PyrexTypes.c_ptr_type(type) # A function itself isn't an l-value
if not type.is_pyobject and not type.is_memoryviewslice:
if not type.is_pyobject and not type.is_memoryviewslice and not type.is_cyp_class:
# Make manage_ref canonical, so that manage_ref will always mean
# a decref is needed.
manage_ref = False
if type.is_checked_result:
manage_ref = False
freelist = self.temps_free.get((type, manage_ref))
if reusable and freelist is not None and freelist[0]:
......
......@@ -2957,7 +2957,7 @@ class CppIteratorNode(ExprNode):
self.cpp_attribute_op = "->"
# 3) (otherwise) sequence comes from a function call or similar, so we must
# create a temp to store it in
self.cpp_sequence_cname = code.funcstate.allocate_temp(temp_type, manage_ref=False)
self.cpp_sequence_cname = code.funcstate.allocate_temp(temp_type, manage_ref=temp_type.is_cyp_class)
code.putln("%s = %s%s;" % (self.cpp_sequence_cname,
"&" if temp_type.is_ptr else "",
self.sequence.move_result_rhs()))
......
......@@ -684,41 +684,15 @@ class CheckedResultType(BaseType):
def can_coerce_from_pyobject(self, env):
return self.checked_base_type.can_coerce_from_pyobject(env)
def generate_incref(self, code, cname, **kwds):
self.checked_base_type.generate_incref(code, "%s.result" % cname, **kwds)
def generate_xincref(self, code, cname, **kwds):
self.checked_base_type.generate_xincref(code, "%s.result" % cname, **kwds)
def generate_decref(self, code, cname, **kwds):
self.checked_base_type.generate_decref(code, "%s.result" % cname, **kwds)
def generate_decref_clear(self, code, cname, **kwds):
self.checked_base_type.generate_decref_clear(code, "%s.result" % cname, **kwds)
def generate_xdecref(self, code, cname, **kwds):
self.checked_base_type.generate_xdecref(code, "%s.result" % cname, **kwds)
def generate_xdecref_clear(self, code, cname, **kwds):
self.checked_base_type.generate_xdecref_clear(code, "%s.result" % cname, **kwds)
def generate_gotref(self, code, cname):
self.checked_base_type.generate_gotref(code, "%s.result" % cname)
def generate_xgotref(self, code, cname):
self.checked_base_type.generate_xgotref(code, "%s.result" % cname)
def generate_giveref(self, code, cname):
self.checked_base_type.generate_giveref(code, "%s.result" % cname)
def generate_xgiveref(self, code, cname):
self.checked_base_type.generate_xgiveref(code, "%s.result" % cname)
def generate_decref_set(self, code, cname, rhs_cname):
self.checked_base_type.generate_decref_set(code, "%s.result" % cname, rhs_cname)
def generate_dummy_refcount(self, code, *args, **kwargs):
pass
def generate_xdecref_set(self, code, cname, rhs_cname):
self.checked_base_type.generate_xdecref_set(code, "%s.result" % cname, rhs_cname)
generate_incref = generate_xincref = generate_dummy_refcount
generate_decref = generate_decref_clear = generate_dummy_refcount
generate_xdecref = generate_xdecref_clear = generate_dummy_refcount
generate_gotref = generate_xgotref = generate_dummy_refcount
generate_giveref = generate_xgiveref = generate_dummy_refcount
generate_decref_set = generate_xdecref_set = generate_dummy_refcount
class MemoryViewSliceType(PyrexType):
......
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