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
613c070f
Commit
613c070f
authored
Jul 15, 2015
by
Ian Henriksen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed C++ exception handling for indexing when it is not used for
assignment.
parent
57a5ef18
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+21
-11
No files found.
Cython/Compiler/ExprNodes.py
View file @
613c070f
...
@@ -3263,6 +3263,10 @@ class IndexNode(_IndexingBaseNode):
...
@@ -3263,6 +3263,10 @@ class IndexNode(_IndexingBaseNode):
func_type
=
function
.
type
func_type
=
function
.
type
if
func_type
.
is_ptr
:
if
func_type
.
is_ptr
:
func_type
=
func_type
.
base_type
func_type
=
func_type
.
base_type
self
.
exception_check
=
func_type
.
exception_check
self
.
exception_value
=
func_type
.
exception_value
if
func_type
.
exception_check
and
not
setting
:
self
.
is_temp
=
True
self
.
index
=
self
.
index
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
index
=
self
.
index
.
coerce_to
(
func_type
.
args
[
0
].
type
,
env
)
self
.
type
=
func_type
.
return_type
self
.
type
=
func_type
.
return_type
if
setting
and
not
func_type
.
return_type
.
is_reference
:
if
setting
and
not
func_type
.
return_type
.
is_reference
:
...
@@ -3532,7 +3536,7 @@ class IndexNode(_IndexingBaseNode):
...
@@ -3532,7 +3536,7 @@ class IndexNode(_IndexingBaseNode):
error_value
=
'-1'
error_value
=
'-1'
code
.
globalstate
.
use_utility_code
(
code
.
globalstate
.
use_utility_code
(
UtilityCode
.
load_cached
(
"GetItemIntByteArray"
,
"StringTools.c"
))
UtilityCode
.
load_cached
(
"GetItemIntByteArray"
,
"StringTools.c"
))
el
se
:
el
if
not
(
self
.
base
.
type
.
is_cpp_class
and
self
.
exception_check
)
:
assert
False
,
"unexpected type %s and base type %s for indexing"
%
(
assert
False
,
"unexpected type %s and base type %s for indexing"
%
(
self
.
type
,
self
.
base
.
type
)
self
.
type
,
self
.
base
.
type
)
...
@@ -3541,6 +3545,12 @@ class IndexNode(_IndexingBaseNode):
...
@@ -3541,6 +3545,12 @@ class IndexNode(_IndexingBaseNode):
else
:
else
:
index_code
=
self
.
index
.
py_result
()
index_code
=
self
.
index
.
py_result
()
if
self
.
base
.
type
.
is_cpp_class
and
self
.
exception_check
:
translate_cpp_exception
(
code
,
self
.
pos
,
"%s = %s[%s];"
%
(
self
.
result
(),
self
.
base
.
result
(),
self
.
index
.
result
()),
self
.
exception_value
,
self
.
in_nogil_context
)
else
:
code
.
putln
(
code
.
putln
(
"%s = %s(%s, %s%s); if (unlikely(%s == %s)) %s;"
%
(
"%s = %s(%s, %s%s); if (unlikely(%s == %s)) %s;"
%
(
self
.
result
(),
self
.
result
(),
...
...
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