core: handle callbacks that are not functions on Python 3.3
* Fix inspect.getargspec issue for non functions callbacks by creating an empty ArgSpec. There for we ignore all kwargs parameters. Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
This commit is contained in:
parent
d15b3173f1
commit
98e8a1cc04
@ -90,9 +90,14 @@ class Module(SettingsBase):
|
|||||||
wrapped_cb = getattr(cb, "__wrapped__", None)
|
wrapped_cb = getattr(cb, "__wrapped__", None)
|
||||||
if wrapped_cb:
|
if wrapped_cb:
|
||||||
locals()["self"] = self # Add self to the local stack frame
|
locals()["self"] = self # Add self to the local stack frame
|
||||||
args_spec = inspect.getargspec(wrapped_cb)
|
tmp_cb = wrapped_cb
|
||||||
else:
|
else:
|
||||||
args_spec = inspect.getargspec(cb)
|
tmp_cb = cb
|
||||||
|
|
||||||
|
try:
|
||||||
|
args_spec = inspect.getargspec(tmp_cb)
|
||||||
|
except Exception:
|
||||||
|
args_spec = inspect.ArgSpec([], None, None, None)
|
||||||
|
|
||||||
# Remove all variables present in kwargs that are not used in the
|
# Remove all variables present in kwargs that are not used in the
|
||||||
# callback, except if there is a keyword argument.
|
# callback, except if there is a keyword argument.
|
||||||
|
Loading…
Reference in New Issue
Block a user