Skip to content

Commit

Permalink
Correct _get_parameters.
Browse files Browse the repository at this point in the history
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
    * praw-dev/praw#541 (comment)
  • Loading branch information
jaccarmac committed Oct 29, 2015
1 parent 72e76ab commit eaff751
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit eaff751

Please sign in to comment.