jenkins-bot has submitted this change and it was merged.
Change subject: Fix random generator handling of no results ......................................................................
Fix random generator handling of no results
If a random generator returns no results, QueryGenerator.__iter__ loops forever.
This was found when running site_tests on test.wikidata.org; resulting in a travis build breakage in testRandompages
Change-Id: I5e6fde7505a1a2995c58d309233dcb185a69d74a --- M pywikibot/data/api.py 1 file changed, 3 insertions(+), 0 deletions(-)
Approvals: XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index cfc19e3..229b88a 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -927,6 +927,9 @@ # note: self.limit could be -1 if self.limit and self.limit > 0 and count >= self.limit: return + else: + # No results. + return if self.module == "random" and self.limit: # "random" module does not return "query-continue" # now we loop for a new random query