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
8164bb31
Commit
8164bb31
authored
Jan 24, 2013
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #177 from strohel/propagate-error-memoryview
Fix error propagation from memoryview-returning functions
parents
d06c8958
ec2c8d97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
tests/memoryview/view_return_errors.pyx
tests/memoryview/view_return_errors.pyx
+31
-0
No files found.
Cython/Compiler/Nodes.py
View file @
8164bb31
...
...
@@ -1770,7 +1770,7 @@ class FuncDefNode(StatNode, BlockNode):
# If we are using the non-error cleanup section we should
# jump past it if we have an error. The if-test below determine
# whether this section is used.
if
buffers_present
or
is_getbuffer_slot
:
if
buffers_present
or
is_getbuffer_slot
or
self
.
return_type
.
is_memoryviewslice
:
code
.
put_goto
(
code
.
return_from_error_cleanup_label
)
# ----- Non-error return cleanup
...
...
tests/memoryview/view_return_errors.pyx
0 → 100644
View file @
8164bb31
# mode: run
cdef
double
[:]
foo
(
int
i
):
if
i
==
1
:
raise
AttributeError
(
'dummy'
)
if
i
==
2
:
raise
RuntimeError
(
'dummy'
)
if
i
==
3
:
raise
ValueError
(
'dummy'
)
if
i
==
4
:
raise
TypeError
(
'dummy'
)
def
propagate
(
i
):
'''
>>> propagate(0)
TypeError('Memoryview return value is not initialized',)
>>> propagate(1)
AttributeError('dummy',)
>>> propagate(2)
RuntimeError('dummy',)
>>> propagate(3)
ValueError('dummy',)
>>> propagate(4)
TypeError('dummy',)
'''
try
:
foo
(
i
)
except
Exception
as
e
:
print
repr
(
e
)
else
:
print
'Exception sublass not raised'
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