From eaff751319592db73271408d6ac282e00a1deaf3 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Thu, 29 Oct 2015 14:11:07 -0600 Subject: [PATCH] Correct _get_parameters. The two versions of parameter parsing were not, in fact, equivalent. The return types of `inspect.signature` and `inspect.getargspec` are, in fact, subtly different. See: * https://docs.python.org/3/library/inspect.html#inspect.signature * https://github.com/praw-dev/praw/issues/541#issuecomment-152280322 --- pep8.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pep8.py b/pep8.py index c22e63ee..b1916cce 100755 --- a/pep8.py +++ b/pep8.py @@ -1316,7 +1316,10 @@ def _is_eol_token(token, _eol_token=_is_eol_token): def _get_parameters(function): if sys.version_info >= (3, 3): - return list(inspect.signature(function).parameters) + return [parameter.name + for parameter + in inspect.signature(function).parameters.values() + if parameter.kind == parameter.POSITIONAL_OR_KEYWORD] else: return inspect.getargspec(function)[0]