Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
3c2d60a1
Commit
3c2d60a1
authored
Dec 15, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reference counting in 'consume' operations
parent
5ea4b23c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+27
-26
No files found.
Cython/Compiler/ExprNodes.py
View file @
3c2d60a1
...
@@ -11410,10 +11410,9 @@ class ConsumeNode(ExprNode):
...
@@ -11410,10 +11410,9 @@ class ConsumeNode(ExprNode):
self
.
generate_runtime_check
=
True
self
.
generate_runtime_check
=
True
self
.
type
=
PyrexTypes
.
cyp_class_qualified_type
(
operand_type
,
'iso~'
)
self
.
type
=
PyrexTypes
.
cyp_class_qualified_type
(
operand_type
,
'iso~'
)
self
.
operand_is_named
=
self
.
operand
.
is_name
or
self
.
operand
.
is_attribute
self
.
operand_is_named
=
self
.
operand
.
is_name
or
self
.
operand
.
is_attribute
self
.
is_temp
=
self
.
operand_is_named
or
self
.
generate_runtime_check
self
.
is_temp
=
self
.
operand_is_named
or
(
self
.
generate_runtime_check
and
not
self
.
operand
.
is_temp
)
if
self
.
is_temp
:
if
not
self
.
operand_is_named
and
not
self
.
generate_runtime_check
:
# We steal the reference of the operand.
return
self
.
operand
self
.
use_managed_ref
=
False
return
self
return
self
def
may_be_none
(
self
):
def
may_be_none
(
self
):
...
@@ -11429,11 +11428,13 @@ class ConsumeNode(ExprNode):
...
@@ -11429,11 +11428,13 @@ class ConsumeNode(ExprNode):
def
calculate_result_code
(
self
):
def
calculate_result_code
(
self
):
return
self
.
operand
.
result
()
return
self
.
operand
.
result
()
def
result_in_temp
(
self
):
return
self
.
is_temp
or
self
.
operand
.
result_in_temp
()
def
generate_result_code
(
self
,
code
):
def
generate_result_code
(
self
,
code
):
if
self
.
is_temp
:
operand_result
=
self
.
operand
.
result
()
result_code
=
self
.
result
()
result_code
=
self
.
result
()
code
.
putln
(
"%s = %s;"
%
(
result_code
,
operand_result
))
if
self
.
is_temp
:
code
.
putln
(
"%s = %s;"
%
(
result_code
,
self
.
operand
.
result
()))
if
self
.
generate_runtime_check
:
if
self
.
generate_runtime_check
:
code
.
putln
(
"if (%s != NULL && !%s->CyObject_iso()) {"
%
(
result_code
,
result_code
))
code
.
putln
(
"if (%s != NULL && !%s->CyObject_iso()) {"
%
(
result_code
,
result_code
))
if
self
.
nogil
:
if
self
.
nogil
:
...
@@ -11448,11 +11449,11 @@ class ConsumeNode(ExprNode):
...
@@ -11448,11 +11449,11 @@ class ConsumeNode(ExprNode):
code
.
putln
(
code
.
putln
(
code
.
error_goto
(
self
.
pos
))
code
.
error_goto
(
self
.
pos
))
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
# We steal the reference of the operand.
if
self
.
operand_is_named
:
code
.
putln
(
"%s = NULL;"
%
operand_result
)
code
.
putln
(
"%s = NULL;"
%
self
.
operand
.
result
()
)
if
self
.
operand
.
is_temp
:
# TODO: steal the reference of the operand instead
def
generate_post_assignment_code
(
self
,
code
):
code
.
put_incref
(
self
.
result
(),
self
.
typ
e
)
self
.
operand
.
generate_post_assignment_code
(
cod
e
)
class
TypeidNode
(
ExprNode
):
class
TypeidNode
(
ExprNode
):
...
...
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