diff --git a/spyne/decorator.py b/spyne/decorator.py index 6d01853cc..b00efa9d9 100644 --- a/spyne/decorator.py +++ b/spyne/decorator.py @@ -29,7 +29,7 @@ import spyne.const.xml from copy import copy -from inspect import isclass +from inspect import isclass, signature from spyne import MethodDescriptor @@ -58,10 +58,9 @@ def _produce_input_message(f, params, in_message_name, in_variable_names, if argnames is None: try: - argcount = f.__code__.co_argcount - argnames = f.__code__.co_varnames[arg_start:argcount] + argnames = tuple(signature(f).parameters)[arg_start:] - except AttributeError: + except ValueError: raise TypeError( "It's not possible to instrospect builtins. You must pass a " "sequence of argument names as the '_args' argument to the "