jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1337956?usp=email )

Change subject: category: Honor zero article limits before traversal
......................................................................

category: Honor zero article limits before traversal

Recursive article traversal decrements the limit after yielding a page.
Starting at zero therefore makes the counter negative and fails to stop
iteration.

Return immediately when total is zero, avoiding category traversal and
unnecessary requests.

Change-Id: I8ccfb62d0f5386a06c85710b6cd304e42e129ff3
---
M pywikibot/page/_category.py
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/page/_category.py b/pywikibot/page/_category.py
index 786b8d9..8422500 100644
--- a/pywikibot/page/_category.py
+++ b/pywikibot/page/_category.py
@@ -180,6 +180,9 @@
             raise TypeError(
                 "articles() got an unexpected keyword argument 'member_type'")

+        if total == 0:
+            return
+
         member_type = ['page', 'file']
         if not recurse:
             yield from self.members(

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1337956?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8ccfb62d0f5386a06c85710b6cd304e42e129ff3
Gerrit-Change-Number: 1337956
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to