jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] ItemPage: Avoid changing dict in toJSON
......................................................................
[FIX] ItemPage: Avoid changing dict in toJSON
In toJSON it changed the claims dict while iterating over it. As with
Python 3 the iterator is just a view to the current state and thus this
is not allowed.
Change-Id: Ib6dd67f8afdc90c576b2d433b24059f339ae84fa
---
M pywikibot/page.py
1 file changed, 4 insertions(+), 6 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
Ricordisamoa: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/pywikibot/page.py b/pywikibot/page.py
index 5607ace..e99694e 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -3519,12 +3519,10 @@
for dbName in sitelinks:
sitelinks[dbName] = {'site': dbName, 'title':
sitelinks[dbName]}
- claims = self.claims.copy()
- for prop in claims.keys():
- if len(claims[prop]) > 0:
- claims[prop] = [claim.toJSON() for claim in claims[prop]]
- else:
- del claims[prop]
+ claims = {}
+ for prop in self.claims:
+ if len(self.claims[prop]) > 0:
+ claims[prop] = [claim.toJSON() for claim in self.claims[prop]]
if diffto and 'claims' in diffto:
temp = {}
--
To view, visit
https://gerrit.wikimedia.org/r/198569
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6dd67f8afdc90c576b2d433b24059f339ae84fa
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ricordisamoa <ricordisamoa(a)openmailbox.org>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>