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
Gwenaël Samain
cython
Commits
1336b25e
Commit
1336b25e
authored
Mar 28, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect cypclass dereferencing with overloaded operators
parent
e50ed63a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
1336b25e
...
...
@@ -11384,7 +11384,7 @@ class NumBinopNode(BinopNode):
else
:
result1
,
result2
=
self
.
operand1
.
result
(),
self
.
operand2
.
result
()
if
self
.
operand1
.
type
.
is_cyp_class
:
result1
=
'*'
+
result1
result1
=
"(*%s)"
%
result1
return
"(%s %s %s)"
%
(
result1
,
self
.
operator
,
result2
)
else
:
func
=
self
.
type
.
binary_op
(
self
.
operator
)
...
...
@@ -11794,7 +11794,7 @@ class ModNode(DivNode):
else
:
op1
=
self
.
operand1
.
result
()
if
self
.
operand1
.
type
.
is_cyp_class
:
op1
=
'*'
+
op1
op1
=
"(*%s)"
%
op1
return
"(%s %% %s)"
%
(
op1
,
self
.
operand2
.
result
())
...
...
@@ -11865,7 +11865,7 @@ class PowNode(NumBinopNode):
return
self
.
type
.
cast_code
(
operand
.
result
())
op1
=
typecast
(
self
.
operand1
)
if
self
.
operand1
.
type
.
is_cyp_class
:
op1
=
'*'
+
op1
op1
=
"(*%s)"
%
op1
return
"%s(%s, %s)"
%
(
self
.
pow_func
,
op1
,
...
...
@@ -12821,7 +12821,7 @@ class PrimaryCmpNode(ExprNode, CmpNode):
else
:
result1
,
result2
=
operand1
.
result
(),
operand2
.
result
()
if
operand1
.
type
.
is_cyp_class
and
self
.
operator
not
in
(
"is"
,
"is_not"
):
result1
=
'*'
+
result1
result1
=
"(*%s)"
%
result1
if
self
.
is_memslice_nonecheck
:
if
operand1
.
type
.
is_memoryviewslice
:
result1
=
"((PyObject *) %s.memview)"
%
result1
...
...
Cython/Compiler/Nodes.py
View file @
1336b25e
...
...
@@ -5910,7 +5910,7 @@ class InPlaceAssignmentNode(AssignmentNode):
# TODO: make sure overload is declared
l_op
=
lhs
.
result
()
if
lhs
.
type
.
is_cyp_class
:
l_op
=
'*'
+
l_op
l_op
=
"(*%s)"
%
l_op
code
.
putln
(
"%s %s= %s;"
%
(
l_op
,
c_op
,
rhs
.
result
()))
lhs
.
generate_subexpr_disposal_code
(
code
)
lhs
.
free_subexpr_temps
(
code
)
...
...
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