diff options
| author | Josh Schneier <josh.schneier@gmail.com> | 2018-08-06 23:12:51 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-08-07 17:37:35 -0400 |
| commit | f1bf069ec1a3d4761ab03ccae00961bc3f2aea8a (patch) | |
| tree | 5f7fd1e7045a7f014dde00a268a623ca38f0272d /django/utils | |
| parent | 756b859576503a5dae7886bd1f2bbc3fe56ee1f7 (diff) | |
Refs #29244 -- Fixed django.utils.inspect.method_has_no_args() for bound methods.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/inspect.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/utils/inspect.py b/django/utils/inspect.py index 15cd7fbc45..293cbdffa1 100644 --- a/django/utils/inspect.py +++ b/django/utils/inspect.py @@ -52,11 +52,11 @@ def func_accepts_var_args(func): def method_has_no_args(meth): """Return True if a method only accepts 'self'.""" - args = [ + count = len([ p for p in inspect.signature(meth).parameters.values() if p.kind == p.POSITIONAL_OR_KEYWORD - ] - return len(args) == 1 + ]) + return count == 0 if inspect.ismethod(meth) else count == 1 def func_supports_parameter(func, parameter): |
