Page MenuHomePhabricator

ItemPage.get causes TypeError
Closed, ResolvedPublic

Description

@Ricordisamoa has kept a -1 on the pending patch for T68120 for a month.

It is a slight extension from that task, but hopefully giving it a new task with a better explanation will break the deadlock, as other patches in Gerrit depend on that patchset.

Here is what the current code does, as is explained in the docstring.

$ python
Python 2.7.5 (default, Apr 10 2015, 08:09:05) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywikibot
>>> s = pywikibot.Site('wikidata', 'wikidata').data_repository()
>>> i = pywikibot.ItemPage(s, 'Q66')
>>> i.get(True, False, 'foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pywikibot/page.py", line 3730, in get
    data = super(ItemPage, self).get(force=force, *args, **kwargs)
TypeError: get() got multiple values for keyword argument 'force'
>>> i.get(force=force, get_redirect=True, 'foo')
  File "<stdin>", line 1
SyntaxError: non-keyword arg after keyword arg

The errors are identical in Python 3.

As far as I know, there is no way that WikibasePage.get could support passing args into DataSite.loadcontent.
Is there some incantation where using args works and needs to be supported?

Event Timeline

jayvdb claimed this task.
jayvdb raised the priority of this task from to High.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb added subscribers: gerritbot, Legoktm, jayvdb and 2 others.

You can merge your own patches, of course.
Perhaps instead of "ItemPage.get causes TypeError" you meant "Prevent Ricordisamoa from using -1"?

Change 216535 had a related patch set uploaded (by John Vandenberg):
WikibasePage.get: Do not pass *args into *props

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

You -1'ed a patch caused it to stall. And to preempt anyone opening a bug report because of the bug the patch is fixing, John opened this one here. It's not about preventing you to -1 anything but about the bug in our library. And it mentions that there is already an unmerged patch which is -1'ed by you at that time.

This bug is about the existence/usability of the var args while T68120 was about using additional keyword arguments from superclasses.

You can merge your own patches, of course.
Perhaps instead of "ItemPage.get causes TypeError" you meant "Prevent Ricordisamoa from using -1"?

No, I hope that a better and easily reproducible bug report will help by providing clarity on the problem that I seek to fix. And here you can better explain why the bug report is wrong, or explain better alternatives to the offered fix.

Change 216535 merged by jenkins-bot:
WikibasePage.get: Do not pass *args into *props

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