Skip to content

inspect.getargspec() is deprecated and will be removed in Python 3.6 #541

@ghost

Description

When using PRAW with the recently released Python 3.5 a warning shows:

DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead

Python's documentation on inspect.getargspec() says:

Deprecated since version 3.0: Use signature() and Signature Object, which provide a better introspecting API for callables. This function will be removed in Python 3.6.

In the file praw/decorators.py the function inspect.getargspec() is used twice, to get a list of a function arguments' names, both lines are identical:

func_args = inspect.getargspec(function).args

This can easily be made compatible with Python 3.6 by changing the two lines to:

func_args = list(inspect.signature(function).parameters.keys())

which, to my knowledge, produces the exact same list of arguments' names so it should work with the rest of the code.

But, the problem is that the inspect.signature() function, added in Python 3.0, wasn't backported to Python 2.7 and thus isn't supported by Python 2.

That's the limit of my skills I'm afraid. I'm not a programmer experienced enough to know what to do in such a case, I don't know how PRAW can be made compatible with both python 2.7 and 3.6, so instead of a pull request I can only open a new issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions