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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
2b72cc71
Commit
2b72cc71
authored
Oct 07, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust cypclass pointers before identity check with 'is' or 'is not'
parent
260c107b
Changes
1
Hide 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 @
2b72cc71
...
...
@@ -13276,11 +13276,23 @@ class PrimaryCmpNode(ExprNode, CmpNode):
operator
=
"__contains__"
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
])
if
entry
is
None
:
if
self
.
operator
in
(
"is"
,
"is_not"
)
\
and
(
type1
.
is_ptr
or
type1
.
is_cyp_class
)
\
and
(
type2
.
is_ptr
or
type2
.
is_cyp_class
):
self
.
type
=
PyrexTypes
.
c_bint_type
return
if
self
.
operator
in
(
"is"
,
"is_not"
):
if
type1
.
is_cyp_class
and
type2
.
is_cyp_class
:
common_type
=
PyrexTypes
.
independent_spanning_type
(
type1
,
type2
)
if
common_type
.
is_error
:
common_type
=
PyrexTypes
.
cy_object_type
if
type1
.
is_const_cyp_class
or
type2
.
is_const_cyp_class
:
if
not
common_type
.
is_const_cyp_class
:
common_type
=
PyrexTypes
.
cyp_class_const_type
(
common_type
)
# do not analyse the TypecastNode
# to ensure a simple pointer cast is used and not a user-defined conversion method
self
.
operand1
=
TypecastNode
(
self
.
operand1
.
pos
,
operand
=
self
.
operand1
,
type
=
common_type
)
self
.
operand2
=
TypecastNode
(
self
.
operand2
.
pos
,
operand
=
self
.
operand2
,
type
=
common_type
)
self
.
type
=
PyrexTypes
.
c_bint_type
return
elif
(
type1
.
is_ptr
or
type1
.
is_cyp_class
)
and
(
type2
.
is_ptr
or
type2
.
is_cyp_class
):
self
.
type
=
PyrexTypes
.
c_bint_type
return
error
(
self
.
pos
,
"Invalid types for '%s' (%s, %s)"
%
(
self
.
operator
,
type1
,
type2
))
self
.
type
=
PyrexTypes
.
error_type
...
...
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