mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-10 07:14:48 +03:00
Fixes #4506: Support Python 3 annotations on fields callables
This commit is contained in:
parent
7ab4a587d9
commit
6013bcb425
|
@ -59,7 +59,11 @@ def is_simple_callable(obj):
|
||||||
if not (function or method):
|
if not (function or method):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
args, _, _, defaults = inspect.getargspec(obj)
|
if six.PY2:
|
||||||
|
args, _, _, defaults = inspect.getargspec(obj)
|
||||||
|
else:
|
||||||
|
args, _, _, defaults = inspect.getfullargspec(obj)[:4]
|
||||||
|
|
||||||
len_args = len(args) if function else len(args) - 1
|
len_args = len(args) if function else len(args) - 1
|
||||||
len_defaults = len(defaults) if defaults else 0
|
len_defaults = len(defaults) if defaults else 0
|
||||||
return len_args <= len_defaults
|
return len_args <= len_defaults
|
||||||
|
|
Loading…
Reference in New Issue
Block a user