Page MenuHomePhabricator

unsupported operand type for generator and set
Closed, ResolvedPublic

Description

In some circumstances the following error occurs in api module

======================================================================
ERROR: test_BlockEntry_unblock_aged (__main__.TestLogentryParams)
Test BlockEntry methods for unblock action on anarchopedia:en
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\pwb\GIT\core\tests\aspects.py", line 688, in wrapped_method
    func(self, key)
  File ".\tests\logentry_tests.py", line 176, in test_BlockEntry_unblock
    logentry = self._get_logentry('block/unblock')
  File ".\tests\logentry_tests.py", line 70, in _get_logentry
    return next(iter(self.site.logevents(logtype=logtype, total=1)))
  File "C:\pwb\GIT\core\pywikibot\site.py", line 4273, in logevents
    step=step, total=total)
  File "C:\pwb\GIT\core\pywikibot\site.py", line 1916, in _generator
    gen = gen_class(type_arg, **req_args)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 2969, in __init__
    ListGenerator.__init__(self, "logevents", **kwargs)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 2956, in __init__
    QueryGenerator.__init__(self, **kwargs)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 2512, in __init__
    self.site._paraminfo.fetch('query+' + mod for mod in self.modules)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 579, in fetch
    self._fetch(modules)
  File "C:\pwb\GIT\core\pywikibot\data\api.py", line 598, in _fetch
    modules = modules - set(self._paraminfo.keys())
TypeError: unsupported operand type(s) for -: 'generator' and 'set'

Event Timeline

Xqt raised the priority of this task from to High.
Xqt updated the task description. (Show Details)
Xqt added a project: Pywikibot.
Xqt subscribed.

Change 423701 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] ensure "modules" parameter of ParamInfo._fetch is a set

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

Change 441152 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] api.ParamInfo.fetch: Expect modules to be of type set or frozenset

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

Change 423701 abandoned by Dalba:
[bugfix] ensure "modules" parameter of ParamInfo._fetch is a set

Reason:
Is a breaking change for Paraminfo.fetch.

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

Change 423701 restored by Dalba:
[bugfix] ensure "modules" parameter of ParamInfo._fetch is a set

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

Change 441152 abandoned by Dalba:
api.ParamInfo.fetch: Expect modules to be of type set or frozenset

Reason:
Breaking change in Paraminfo.fetch.

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

Change 423701 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] ensure "modules" parameter of ParamInfo._fetch is a set

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