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
d287f8b8
Commit
d287f8b8
authored
Jul 02, 2015
by
Ian Henriksen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed C++ exception translation for overloaded binary operators.
parent
c0da2af7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+17
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
d287f8b8
...
...
@@ -10023,6 +10023,14 @@ class BinopNode(ExprNode):
self
.
type_error
()
return
func_type
=
entry
.
type
self
.
exception_check
=
func_type
.
exception_check
self
.
exception_value
=
func_type
.
exception_value
if
self
.
exception_check
==
'+'
:
# Used by NumBinopNodes to break up expressions involving multiple
# operators so that exceptions can be handled properly.
self
.
is_temp
=
1
if
self
.
exception_value
is
None
:
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"CppExceptionConversion"
,
"CppSupport.cpp"
))
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
if
len
(
func_type
.
args
)
==
1
:
...
...
@@ -10089,6 +10097,13 @@ class BinopNode(ExprNode):
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_gotref
(
self
.
py_result
())
elif
self
.
is_temp
:
# C++ overloaded operators with exception values are currently all
# handled through temporaries.
if
self
.
is_cpp_operation
()
and
self
.
exception_check
==
'+'
:
translate_cpp_exception
(
code
,
self
.
pos
,
"%s = %s;"
%
(
self
.
result
(),
self
.
calculate_result_code
()),
self
.
exception_value
,
self
.
in_nogil_context
)
else
:
code
.
putln
(
"%s = %s;"
%
(
self
.
result
(),
self
.
calculate_result_code
()))
def
type_error
(
self
):
...
...
@@ -10227,7 +10242,7 @@ class NumBinopNode(BinopNode):
self
.
operand1
.
result
(),
self
.
operand2
.
result
(),
self
.
overflow_bit_node
.
overflow_bit
)
elif
self
.
infix
:
elif
self
.
type
.
is_cpp_class
or
self
.
infix
:
return
"(%s %s %s)"
%
(
self
.
operand1
.
result
(),
self
.
operator
,
...
...
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