Page MenuHomePhabricator

Early return does not work for tools.intersect_generators
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Add a print statement in front of the early return in line 925
  • use this code snippet:
>>> import pwb, pywikibot as py
>>> from pywikibot.tools import intersect_generators as isg
>>> list(isg('B', 'ABBBBBBBBBBBBBBBBBBBB'))
[B]
>>> list(isg('B', 'ABBBBBBBBBBBBBBBBBBBB', allow_duplicates=True))
['B']

What happens?:
The print statement is never printed and the early return is never used. Anyway the result is as expected.

What should have happened instead?:
Early return the function if there is only one active iterable and the counter has no remaining entry of the other iterables

Details

Related Changes in Gerrit:

Event Timeline

Xqt triaged this task as Low priority.Oct 13 2021, 4:32 PM

Change 608153 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Rewrite tools.intersect_generators

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

Xqt claimed this task.

Change 608153 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Rewrite tools.intersect_generators

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