mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 06:14:47 +03:00
fixed check for simple function in fields to support type annotated functions[F
This commit is contained in:
parent
88c80fe2e9
commit
82475ed5f5
|
@ -55,8 +55,10 @@ def is_simple_callable(obj):
|
|||
|
||||
if not (function or method):
|
||||
return False
|
||||
|
||||
if six.PY2:
|
||||
args, _, _, defaults = inspect.getargspec(obj)
|
||||
else:
|
||||
args, _, _, defaults, _, _, _ = inspect.getfullargspec(obj)
|
||||
len_args = len(args) if function else len(args) - 1
|
||||
len_defaults = len(defaults) if defaults else 0
|
||||
return len_args <= len_defaults
|
||||
|
|
Loading…
Reference in New Issue
Block a user