Add missing 'throw' modifiers as needed to method signatures in helper classes
This commit is contained in:
1 parent
f46b8fffa0
commit
39db96d5b2
4 files changed
+17
-1
No files matched your search
@@ -973,6 +973,9 @@ class CppVirtualMethodProxy(ReverseWrapperBase):
|
||||
else:
|
||||
decl_post_modifiers = ''
|
||||
|
||||
if self.method.throw:
|
||||
decl_post_modifiers += " throw (%s)" % (', '.join([ex.full_name for ex in self.method.throw]),)
|
||||
|
||||
params_list = ', '.join([join_ctype_and_name(param.ctype, param.name)
|
||||
for param in self.parameters])
|
||||
code_sink.writeln("virtual %s %s(%s)%s;" %
|
||||
@@ -987,6 +990,9 @@ class CppVirtualMethodProxy(ReverseWrapperBase):
|
||||
else:
|
||||
decl_post_modifiers = []
|
||||
|
||||
if self.method.throw:
|
||||
decl_post_modifiers.append("throw (%s)" % (', '.join([ex.full_name for ex in self.method.throw]),))
|
||||
|
||||
## if the python subclass doesn't define a virtual method,
|
||||
## just chain to parent class and don't do anything else
|
||||
call_params = ', '.join([param.name for param in self.parameters])
|
||||
|
||||
@@ -490,6 +490,12 @@ ClassThatThrows::ClassThatThrows (double x) throw (DomainError)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ClassThatThrows::throw_error () const throw (std::exception)
|
||||
{
|
||||
throw std::runtime_error ("an error");
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
my_inverse_func2 (double x) throw (std::exception)
|
||||
|
||||
@@ -1083,6 +1083,8 @@ public:
|
||||
// returns 1/x, raises DomainError if x == 0
|
||||
double my_inverse_method (double x) throw (DomainError);
|
||||
double my_inverse_method2 (double x) throw (std::exception);
|
||||
|
||||
virtual int throw_error () const throw (std::exception);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ int %s::custom_method_added_by_a_hook(int x)
|
||||
mod.add_function('my_inverse_func', 'double', [Parameter.new('double', 'x')],
|
||||
throw=[DomainError])
|
||||
|
||||
ClassThatThrows = mod.add_class('ClassThatThrows')
|
||||
ClassThatThrows = mod.add_class('ClassThatThrows', allow_subclassing=True)
|
||||
ClassThatThrows.add_constructor([Parameter.new('double', 'x')], throw=[DomainError])
|
||||
ClassThatThrows.add_method('my_inverse_method', 'double', [Parameter.new('double', 'x')],
|
||||
throw=[DomainError])
|
||||
@@ -527,6 +527,8 @@ int %s::custom_method_added_by_a_hook(int x)
|
||||
ClassThatThrows.add_method('my_inverse_method2', 'double', [Parameter.new('double', 'x')],
|
||||
throw=[std_exception])
|
||||
|
||||
ClassThatThrows.add_method('throw_error', 'int', [], throw=[std_exception], is_const=True, is_virtual=True)
|
||||
|
||||
# https://bugs.launchpad.net/pybindgen/+bug/450255
|
||||
ProtectedConstructor = mod.add_class('ProtectedConstructor')
|
||||
ProtectedConstructor.add_constructor([])
|
||||
|
||||
Reference in new issue
Block a user