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
3d5881df
Commit
3d5881df
authored
May 09, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct typecast for cypclass casts: make it temporary (properly handles refcount)
parent
45fc7d21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+17
-5
No files found.
Cython/Compiler/ExprNodes.py
View file @
3d5881df
...
@@ -10536,6 +10536,8 @@ class TypecastNode(ExprNode):
...
@@ -10536,6 +10536,8 @@ class TypecastNode(ExprNode):
operator
=
'operator '
+
self
.
type
.
declaration_code
(
''
)
operator
=
'operator '
+
self
.
type
.
declaration_code
(
''
)
entry
=
self
.
operand
.
type
.
scope
.
lookup_here
(
operator
)
entry
=
self
.
operand
.
type
.
scope
.
lookup_here
(
operator
)
self
.
overloaded
=
entry
is
not
None
self
.
overloaded
=
entry
is
not
None
if
self
.
type
.
is_cyp_class
:
self
.
is_temp
=
True
if
self
.
type
.
is_ptr
and
self
.
type
.
base_type
.
is_cfunction
and
self
.
type
.
base_type
.
nogil
:
if
self
.
type
.
is_ptr
and
self
.
type
.
base_type
.
is_cfunction
and
self
.
type
.
base_type
.
nogil
:
op_type
=
self
.
operand
.
type
op_type
=
self
.
operand
.
type
if
op_type
.
is_ptr
:
if
op_type
.
is_ptr
:
...
@@ -10600,11 +10602,21 @@ class TypecastNode(ExprNode):
...
@@ -10600,11 +10602,21 @@ class TypecastNode(ExprNode):
def
generate_result_code
(
self
,
code
):
def
generate_result_code
(
self
,
code
):
if
self
.
is_temp
:
if
self
.
is_temp
:
if
self
.
type
.
is_pyobject
:
code
.
putln
(
code
.
putln
(
"%s = (PyObject *)%s;"
%
(
"%s = (PyObject *)%s;"
%
(
self
.
result
(),
self
.
result
(),
self
.
operand
.
result
()))
self
.
operand
.
result
()))
code
.
put_incref
(
self
.
result
(),
self
.
ctype
())
code
.
put_incref
(
self
.
result
(),
self
.
ctype
())
elif
self
.
type
.
is_cyp_class
:
star
=
"*"
if
self
.
overloaded
else
""
operand_result
=
"%s%s"
%
(
star
,
self
.
operand
.
result
())
code
.
putln
(
"%s = (%s)(%s);"
%
(
self
.
result
(),
self
.
type
.
declaration_code
(
''
),
operand_result
))
code
.
put_cyincref
(
self
.
result
())
ERR_START
=
"Start may not be given"
ERR_START
=
"Start may not be given"
...
...
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