Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xavier Thompson
cython
Commits
a7a448d6
Commit
a7a448d6
authored
4 years ago
by
Xavier Thompson
Browse files
Options
Download
Email Patches
Plain Diff
Replace some unsafe cypclass decrefs by xdecref
parent
4610ff37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-5
No files found.
Cython/Compiler/ExprNodes.py
View file @
a7a448d6
...
@@ -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"))
...
...
This diff is collapsed.
Click to expand it.
Cython/Compiler/Nodes.py
View file @
a7a448d6
...
@@ -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:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment