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

Change subject: site: Read redirect page data directly
......................................................................

site: Read redirect page data directly

Retrieve the sole API page value through its iterator.

Avoid copying the pages mapping into a temporary list.

Change-Id: I85737df077f34bed39cea9d76769eca4d61d4a47
---
M pywikibot/site/_apisite.py
1 file changed, 1 insertion(+), 1 deletion(-)

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




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 5463714..ff1fae9 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1698,7 +1698,7 @@
             page._redirtarget = target
             return page._redirtarget

-        pagedata = list(result['query']['pages'].values())[0]
+        pagedata = next(iter(result['query']['pages'].values()))
         # There should be only one value in 'pages' (the ultimate
         # target, also in case of double redirects).
         if self.sametitle(pagedata['title'], target_title):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1325866?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: I85737df077f34bed39cea9d76769eca4d61d4a47
Gerrit-Change-Number: 1325866
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