DeprecationWarning: inspect.getargspec() is deprecated

Issue #129 new
Randy Barlow
created an issue

Greetings!

In Python 3.6, I see a few warnings like this:

  /usr/local/lib/python3.6/site-packages/dogpile/cache/util.py:31: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
    args = inspect.getargspec(fn)

Comments (1)

  1. Michael Bayer repo owner

    OK....it was formatargspec that I had to vendor in SQLAlchemy, getargspec is easier as they have thankfully not deprecated getfullargspec().

    the code that codes into dogpile/util/compat.py looks like:

    if py3k:
        ArgSpec = collections.namedtuple("ArgSpec",
                                         ["args", "varargs", "keywords", "defaults"])
    
        from inspect import getfullargspec as inspect_getfullargspec
    
        def inspect_getargspec(func):
            return ArgSpec(
                *inspect_getfullargspec(func)[0:4]
            )
    else:
        from inspect import getargspec as inspect_getfullargspec
        inspect_getargspec = inspect_getfullargspec
    
  2. Log in to comment