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

Change subject: [bugfix] No longer try to follow interwiki redirects
......................................................................

[bugfix] No longer try to follow interwiki redirects

If a redirect target is an interwiki link, a InterwikiRedirectPageError
is raised. Catch this exception in site.pagebacklinks() and don't
try to catch any further backlinks.

Bug: T121833
Change-Id: I1a0e093024d6876e18a5033936507149911ccfa6
---
M pywikibot/site/_generators.py
1 file changed, 7 insertions(+), 1 deletion(-)

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




diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py
index bc429cd..21978e9 100644
--- a/pywikibot/site/_generators.py
+++ b/pywikibot/site/_generators.py
@@ -21,6 +21,7 @@
     APIError,
     Error,
     InconsistentTitleError,
+    InterwikiRedirectPageError,
     InvalidTitleError,
     NoPageError,
     UserRightsError,
@@ -296,7 +297,12 @@
                     # was created) they can be returned as redirects to
                     # themselves; skip these
                     continue
-                if redir.getRedirectTarget() == page:
+                try:
+                    target = redir.getRedirectTarget()
+                except InterwikiRedirectPageError:
+                    target = None
+
+                if target and target == page:
                     genlist[redir.title()] = self.pagebacklinks(
                         redir, follow_redirects=True,
                         filter_redirects=filter_redirects,

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1251548?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: I1a0e093024d6876e18a5033936507149911ccfa6
Gerrit-Change-Number: 1251548
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Thibaut120094 <[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