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
efabce0a
Commit
efabce0a
authored
May 08, 2010
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix except+ for cppclass methods (with Denys Duchier)
parent
b23fde17
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
1 deletion
+61
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+3
-1
tests/run/cpp_exceptions.pyx
tests/run/cpp_exceptions.pyx
+48
-0
tests/run/cpp_exceptions_helper.h
tests/run/cpp_exceptions_helper.h
+10
-0
No files found.
Cython/Compiler/Symtab.py
View file @
efabce0a
...
...
@@ -1616,6 +1616,8 @@ class CppClassScope(Scope):
e
.
cname
)
return
scope
def
add_include_file
(
self
,
filename
):
self
.
outer_scope
.
add_include_file
(
filename
)
class
PropertyScope
(
Scope
):
# Scope holding the __get__, __set__ and __del__ methods for
...
...
tests/run/cpp_exceptions.pyx
View file @
efabce0a
...
...
@@ -10,6 +10,12 @@ cdef extern from "cpp_exceptions_helper.h":
cdef
int
raise_index_value
"raise_index"
(
bint
fire
)
except
+
ValueError
cdef
int
raise_index_custom
"raise_index"
(
bint
fire
)
except
+
raise_py_error
cdef
cppclass
Foo
:
int
bar_raw
"bar"
(
bint
fire
)
except
+
int
bar_value
"bar"
(
bint
fire
)
except
+
ValueError
int
bar_custom
"bar"
(
bint
fire
)
except
+
raise_py_error
def
test_int_raw
(
bint
fire
):
"""
>>> test_int_raw(False)
...
...
@@ -69,3 +75,45 @@ def test_index_custom(bint fire):
TypeError: custom
"""
raise_index_custom
(
fire
)
def
test_cppclass_method_raw
(
bint
fire
):
"""
>>> test_cppclass_method_raw(False)
>>> test_cppclass_method_raw(True)
Traceback (most recent call last):
...
RuntimeError: Unknown exception
"""
foo
=
new
Foo
()
try
:
foo
.
bar_raw
(
fire
)
finally
:
del
foo
def
test_cppclass_method_value
(
bint
fire
):
"""
>>> test_cppclass_method_value(False)
>>> test_cppclass_method_value(True)
Traceback (most recent call last):
...
ValueError
"""
foo
=
new
Foo
()
try
:
foo
.
bar_value
(
fire
)
finally
:
del
foo
def
test_cppclass_method_custom
(
bint
fire
):
"""
>>> test_cppclass_method_custom(False)
>>> test_cppclass_method_custom(True)
Traceback (most recent call last):
...
TypeError: custom
"""
foo
=
new
Foo
()
try
:
foo
.
bar_custom
(
fire
)
finally
:
del
foo
tests/run/cpp_exceptions_helper.h
View file @
efabce0a
...
...
@@ -13,3 +13,13 @@ int raise_index(int fire) {
}
return
0
;
}
class
Foo
{
public:
int
bar
(
int
fire
)
{
if
(
fire
)
{
throw
1
;
}
return
0
;
}
};
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