Page MenuHomePhabricator

inspect.getargspec is deprecated in 3.5 and going to be removed in Python 3.6
Closed, ResolvedPublic

Description

[[https://docs.python.org/3.6/library/inspect.html#inspect.getargspec|inspect.getargspec]] is going to be removed in Python 3.6 and we have at least two usages in pywikibot.tools.remove_last_args and pywikibot.api.Request.

Details

Related Gerrit Patches:

Event Timeline

XZise created this task.Jul 18 2015, 11:15 AM
XZise claimed this task.
XZise raised the priority of this task from to Needs Triage.
XZise updated the task description. (Show Details)
XZise added projects: Pywikibot-tests, Pywikibot.
XZise added subscribers: Aklapper, pywikibot-bugs-list, XZise.
XZise triaged this task as Low priority.Jul 18 2015, 2:07 PM
XZise removed a project: Pywikibot-tests.
XZise set Security to None.

Change 225537 had a related patch set uploaded (by XZise):
[FIX] Implement getargspec in tools

https://gerrit.wikimedia.org/r/225537

From the doc:

Deprecated since version 3.0: Use [[ docs.python.org/3.6/library/inspect.html#inspect.signature | signature() ]] and Signature Object//, which provide a better introspecting API for callables. This function will be removed in Python 3.6.

jayvdb added a subscriber: jayvdb.Jul 18 2015, 5:34 PM

I would prefer that we use future package to switch to signature. We already have some changes in gerrit along these lines; now might be time to polish them up.

XZise added a comment.Jul 18 2015, 6:53 PM

But then future would be necessary for 2.7 too and that would break the policy to only require one package (which is requests) as only Python 3.3+ builds would work without them. I could make the method not part of our API (aka use an underscore) so that when we drop Python 2 support (or won't mind future) we could just remove my patch.

Anyway I'll look into future to implement it using that so that we are free to implement whatever we think is better.

@Ricordisamoa: Yes, I am able to read and actually linked to that doc. But before we had builds on Python 3.6 occurring it issued no deprecation warning even though it had been deprecated since 3.0. I actually checked with -Wall and didn't get any deprecation warning on 3.4.3.

XZise added a comment.Jul 18 2015, 7:04 PM

Okay it appears that future does not support that yet: https://github.com/PythonCharmers/python-future/issues/157

XZise added a comment.EditedJul 21 2015, 7:59 PM

While doing a test run on Python 3.5.0b1 I also got that deprecation warning. Seems like Travis switched from 3.5 to 3.6 just as they added the deprecation to 3.5 too.

XZise renamed this task from inspect.getargspec is going to be removed in Python 3.6 to inspect.getargspec is deprecated in 3.5 and going to be removed in Python 3.6.Jul 23 2015, 1:28 PM
XZise updated the task description. (Show Details)
XZise added a comment.Jul 23 2015, 1:31 PM

While the deprecation warning is more of a problem for tests (because they might not expect it) it should be resolved as soon as possible (and sensible) anyway. For now we could wait on future to implement a backport and use that instead. We also only need few parts so we could implement a very lightweight implementation in the meantime.

Change 229683 had a related patch set uploaded (by XZise):
[FEAT] Add basic support for signature and replace getargspec

https://gerrit.wikimedia.org/r/229683

Change 241147 had a related patch set uploaded (by XZise):
[FEAT] Test Python 3.5 on Travis

https://gerrit.wikimedia.org/r/241147

Change 241147 merged by jenkins-bot:
[FEAT] Test Python 3.5 on Travis

https://gerrit.wikimedia.org/r/241147

Change 225537 merged by jenkins-bot:
[FIX] Implement getargspec in tools

https://gerrit.wikimedia.org/r/225537

XZise closed this task as Resolved.Oct 2 2015, 12:22 PM

Looks like the Python deprecation might be reverted.

http://bugs.python.org/issue20438#msg253473

resulting in

http://bugs.python.org/issue25486

Looks like the Python deprecation might be reverted.
http://bugs.python.org/issue20438#msg253473
resulting in
http://bugs.python.org/issue25486

And it was reverted. The docs still refer to it as deprecated, but no longer commit to future deprecation timeline.