matej_suchanek added a comment.
Tracked this down. The cause is both rPWBC80e00af9e1139b16842535163f8656a5cea9737d <https://phabricator.wikimedia.org/rPWBC80e00af9e1139b16842535163f8656a5cea9737d> and quite permissive implementation of `pywikibot.Claim`. Applies to T224283 <https://phabricator.wikimedia.org/T224283> as well. In claimit.py, we have: name=scripts/claimit.py def treat_page_and_item(self, page, item): for claim in self.claims: # The generator might yield pages from multiple sites site = page.site if page is not None else None self.user_add_claim_unless_exists( item, claim, self.exists_arg, site) `self.claims` is a list of references to preloaded Claim objects. They are //mutable// objects, so when a source is attached to them during the import, the instance keeps it and with the following item another source is added and the claim is saved with two sources and so on... This can only be prevented by creating a new instance of claim every time it is added to an item. Note that harvest_template.py doesn't have this problem because a fresh instance of Claim is always constructed. This can be fixed by creating a method to make copy of claim (and possibly by preventing saving an already imported claim to another item). TASK DETAIL https://phabricator.wikimedia.org/T220131 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: matej_suchanek Cc: matej_suchanek, Tacsipacsi, JAnD, Framawiki, Premeditated, Aklapper, revi, pywikibot-bugs-list, Viztor, DannyS712, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Avicennasis, mys_721tx, jayvdb, Ricordisamoa, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
