1
0
Fork 0

Merge pull request #398 from yarda/python-2.7-getargspec-fix

dbus: fix traceback on python-2.7
This commit is contained in:
Jaroslav Škarvada 2022-01-17 00:47:34 +01:00 committed by GitHub
commit 77f5349936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,7 @@ try:
from inspect import getfullargspec
def getargspec(func):
return getfullargspec(func).args
return getfullargspec(func)
except ImportError:
# Python2 version, drop after support stops
from inspect import getargspec
@ -75,7 +75,7 @@ class DBusExporter(interfaces.ExporterInterface):
def _prepare_for_dbus(self, method, wrapper):
source = """def {name}({args}):
return wrapper({args})
""".format(name=method.__name__, args=', '.join(getargspec(method.__func__)))
""".format(name=method.__name__, args=', '.join(getargspec(method.__func__).args))
code = compile(source, '<decorator-gen-%d>' % len(self._dbus_methods), 'exec')
# https://docs.python.org/3.9/library/inspect.html
# co_consts - tuple of constants used in the bytecode