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
868a2607
Commit
868a2607
authored
Jul 29, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lock-check cypclass operands of binop operations
parent
a25fbc15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+32
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
868a2607
...
@@ -11693,8 +11693,24 @@ class BinopNode(ExprNode):
...
@@ -11693,8 +11693,24 @@ class BinopNode(ExprNode):
if
func_type
.
is_ptr
:
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
func_type
=
func_type
.
base_type
if
len
(
func_type
.
args
)
==
1
:
if
len
(
func_type
.
args
)
==
1
:
if
func_type
.
is_const_method
:
self
.
operand1
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand1
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
if
func_type
.
args
[
0
].
type
.
is_const
:
self
.
operand2
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand2
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
else
:
else
:
if
func_type
.
args
[
0
].
type
.
is_const
:
self
.
operand1
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand1
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
if
func_type
.
args
[
1
].
type
.
is_const
:
self
.
operand2
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand2
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
self
.
operand1
=
self
.
operand1
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand1
=
self
.
operand1
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
1
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
1
].
type
,
env
)
self
.
type
=
func_type
.
return_type
self
.
type
=
func_type
.
return_type
...
@@ -13325,8 +13341,24 @@ class PrimaryCmpNode(ExprNode, CmpNode):
...
@@ -13325,8 +13341,24 @@ class PrimaryCmpNode(ExprNode, CmpNode):
if
self
.
exception_value
is
None
:
if
self
.
exception_value
is
None
:
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"CppExceptionConversion"
,
"CppSupport.cpp"
))
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"CppExceptionConversion"
,
"CppSupport.cpp"
))
if
len
(
func_type
.
args
)
==
1
:
if
len
(
func_type
.
args
)
==
1
:
if
func_type
.
is_const_method
:
self
.
operand1
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand1
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
if
func_type
.
args
[
0
].
type
.
is_const
:
self
.
operand2
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand2
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
else
:
else
:
if
func_type
.
args
[
0
].
type
.
is_const
:
self
.
operand1
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand1
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
if
func_type
.
args
[
1
].
type
.
is_const
:
self
.
operand2
.
ensure_rhs_locked
(
env
,
is_dereferenced
=
True
)
else
:
self
.
operand2
.
ensure_lhs_locked
(
env
,
is_dereferenced
=
True
)
self
.
operand1
=
self
.
operand1
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand1
=
self
.
operand1
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
1
].
type
,
env
)
self
.
operand2
=
self
.
operand2
.
coerce_to
(
func_type
.
args
[
1
].
type
,
env
)
self
.
type
=
func_type
.
return_type
self
.
type
=
func_type
.
return_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