Commit a7a448d6 authored by Xavier Thompson's avatar Xavier Thompson

Replace some unsafe cypclass decrefs by xdecref

parent 4610ff37
...@@ -828,8 +828,12 @@ class ExprNode(Node): ...@@ -828,8 +828,12 @@ class ExprNode(Node):
self.generate_subexpr_disposal_code(code) self.generate_subexpr_disposal_code(code)
self.free_subexpr_temps(code) self.free_subexpr_temps(code)
if self.result() and not self.has_temp_moved: if self.result() and not self.has_temp_moved:
code.put_decref_clear(self.result(), self.ctype(), if self.type.is_cyp_class:
have_gil=not self.in_nogil_context) code.put_xdecref_clear(self.result(), self.ctype(),
have_gil=not self.in_nogil_context)
else:
code.put_decref_clear(self.result(), self.ctype(),
have_gil=not self.in_nogil_context)
if self.has_temp_moved: if self.has_temp_moved:
code.globalstate.use_utility_code( code.globalstate.use_utility_code(
UtilityCode.load_cached("MoveIfSupported", "CppSupport.cpp")) UtilityCode.load_cached("MoveIfSupported", "CppSupport.cpp"))
......
...@@ -3735,7 +3735,7 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3735,7 +3735,7 @@ class DefNodeWrapper(FuncDefNode):
# The conversion from PyObject to CyObject always creates a new CyObject reference. # The conversion from PyObject to CyObject always creates a new CyObject reference.
# This decrements all arguments-as-variables converted straight from an actual argument. # This decrements all arguments-as-variables converted straight from an actual argument.
# This includes CyObjects converted directly from a corresponding PyObject argument. # This includes CyObjects converted directly from a corresponding PyObject argument.
if entry.xdecref_cleanup: if entry.xdecref_cleanup or entry.type.is_cyp_class:
code.put_var_xdecref(entry) code.put_var_xdecref(entry)
else: else:
code.put_var_decref(entry) code.put_var_decref(entry)
...@@ -3743,10 +3743,7 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3743,10 +3743,7 @@ class DefNodeWrapper(FuncDefNode):
if entry.type.is_cyp_class: if entry.type.is_cyp_class:
# The conversion from PyObject to CyObject always creates a new CyObject reference. # The conversion from PyObject to CyObject always creates a new CyObject reference.
# This decrements CyObjects converted from generic PyObject args passed via tuple and kw dict. # This decrements CyObjects converted from generic PyObject args passed via tuple and kw dict.
if entry.xdecref_cleanup: code.put_var_xdecref(entry)
code.put_var_xdecref(entry)
else:
code.put_var_decref(entry)
code.put_finish_refcount_context() code.put_finish_refcount_context()
if not self.return_type.is_void: 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