Allow None to mean ReturnValue.new('void') for functions and methods.
This commit is contained in:
1 parent
f9e6ebf370
commit
9bed1c4a45
3 files changed
+8
-2
No files matched your search
@@ -70,6 +70,9 @@ class CppMethod(ForwardWrapperBase):
|
||||
DeprecationWarning, stacklevel=2)
|
||||
method_name, return_value = return_value, method_name
|
||||
|
||||
if return_value is None:
|
||||
return_value = ReturnValue.new('void')
|
||||
|
||||
if unblock_threads is None:
|
||||
unblock_threads = settings.unblock_threads
|
||||
super(CppMethod, self).__init__(
|
||||
|
||||
@@ -34,6 +34,9 @@ class Function(ForwardWrapperBase):
|
||||
warnings.warn("Function has changed API; see the API documentation (but trying to correct...)",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
function_name, return_value = return_value, function_name
|
||||
|
||||
if return_value is None:
|
||||
return_value = ReturnValue.new('void')
|
||||
|
||||
super(Function, self).__init__(
|
||||
return_value, parameters,
|
||||
|
||||
@@ -76,7 +76,7 @@ int %s::custom_method_added_by_a_hook(int x)
|
||||
is_virtual=True))
|
||||
Zbr.add_static_attribute(ReturnValue.new('int'), 'instance_count')
|
||||
|
||||
mod.add_function(Function('store_zbr', ReturnValue.new('void'),
|
||||
mod.add_function(Function('store_zbr', None,
|
||||
[Parameter.new('Zbr*', 'zbr', transfer_ownership=True)]))
|
||||
mod.add_function(Function('invoke_zbr', ReturnValue.new('int'),
|
||||
[Parameter.new('int', 'x')]))
|
||||
@@ -179,7 +179,7 @@ int %s::custom_method_added_by_a_hook(int x)
|
||||
'call_get_prefix', ReturnValue.new('std::string'), []))
|
||||
|
||||
SomeObject.add_method(CppMethod('set_foo_value',
|
||||
ReturnValue.new('void'),
|
||||
None,
|
||||
[Parameter.new('Foo', 'foo')]))
|
||||
SomeObject.add_method(CppMethod(
|
||||
'get_foo_value', ReturnValue.new('Foo'), []))
|
||||
|
||||
Reference in new issue
Block a user