diff options
author | Simon McVittie <smcv@debian.org> | 2016-03-06 15:38:16 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-03-06 17:09:18 +0000 |
commit | 7881666743df953227ccc403af4edfac7dd7ab8e (patch) | |
tree | be1da5c58b2254a851a6ed319c7c9626aac3e601 /dbus/decorators.py | |
parent | 991c1f8de2f6396801736153173eb83dce0e9c15 (diff) |
decorators: use a more modern idiom for signatures in Python >= 3.4
getargspec() isn't in Python 3.6 development versions.
Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'dbus/decorators.py')
-rw-r--r-- | dbus/decorators.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dbus/decorators.py b/dbus/decorators.py index b164582..71c8be0 100644 --- a/dbus/decorators.py +++ b/dbus/decorators.py @@ -155,7 +155,16 @@ def method(dbus_interface, in_signature=None, out_signature=None, validate_interface_name(dbus_interface) def decorator(func): - args = inspect.getargspec(func)[0] + if hasattr(inspect, 'Signature'): + args = [] + + for arg in inspect.signature(func).parameters.values(): + if arg.kind in (inspect.Parameter.POSITIONAL_ONLY, + inspect.Parameter.POSITIONAL_OR_KEYWORD): + args.append(arg.name) + else: + args = inspect.getargspec(func)[0] + args.pop(0) if async_callbacks: |