jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/372827 )
Change subject: [bugfix] hash for LogEntry should be unique
......................................................................
[bugfix] hash for LogEntry should be unique
Per
https://docs.python.org/3.4/reference/datamodel.html#object.__hash__ :
"it is advised to somehow mix together (e.g. using exclusive or) the hash
values for the components of the object that also play a part in comparison
of objects."
Bug: T173688
Change-Id: If124e1bf61e23543b8972ff65f75094c0bdd255c
---
M pywikibot/logentries.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 26dd3cf..3b4b768 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -56,8 +56,8 @@
self.data._type = self.type()
def __hash__(self):
- """Return the id as the hash."""
- return self.logid()
+ """Combine site and logid as the hash."""
+ return self.logid() ^ hash(self.site)
@property
def _params(self):
--
To view, visit
https://gerrit.wikimedia.org/r/372827
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If124e1bf61e23543b8972ff65f75094c0bdd255c
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>