Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#24979 closed Cleanup/optimization (fixed)

Remove usage of inspect.getargspec()

Reported by: Tim Graham Owned by: nobody
Component: Utilities Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

inspect.getargspec() was deprecated in Python 3.0 and will be removed in 3.6 (ETA late 2016). It started throwing a deprecation warning in Python 3.5 which causes some test failures when we check the number of deprecation warnings so I'd like to deal with it now and avoid introducing more usages.

Its replacement is inspect.signature() which is in all the versions of Python 3 we support, but not 2.7. Options I see:

  1. Add a dependency for the funcsigs backport (only needed on Python 2)
  2. Vendor funcsigs in django.utils (about 1k LOC) (this has been the historical approach)
  3. Write different code for Python 2 & 3

discussion on django-developers about what option to use.

Change History (5)

comment:1 by Tim Graham, 9 years ago

PR which implements option 3.

comment:2 by Claude Paroz, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 3872a331:

Fixed #24979 -- Removed usage of inspect.getargspec().

comment:4 by Tim Graham <timograham@…>, 9 years ago

In e2ea30c:

[1.8.x] Fixed #24979 -- Removed usage of inspect.getargspec().

Backport of 3872a33132a4bb6aa22b237927597bbfdf6f21d7 from master

comment:5 by Tim Graham <timograham@…>, 9 years ago

In 6b631b5c:

[1.8.x] Refs #24979 -- Used inspect.getargspec() on Python 3.2.

inspect.signature() was added in Python 3.3.

Note: See TracTickets for help on using tickets.
Back to Top