details:   https://code.tryton.org/tryton/commit/5ebdd1b3189c
branch:    default
user:      Cédric Krier <[email protected]>
date:      Wed Sep 24 09:28:39 2025 +0200
description:
        Implement __hash__ on Model using xor
diffstat:

 trytond/trytond/model/model.py |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 02082bc9ac46 -r 5ebdd1b3189c trytond/trytond/model/model.py
--- a/trytond/trytond/model/model.py    Wed Sep 24 09:27:26 2025 +0200
+++ b/trytond/trytond/model/model.py    Wed Sep 24 09:28:39 2025 +0200
@@ -383,7 +383,8 @@
         return self.id < other.id
 
     def __hash__(self):
-        return hash((self.__name__, id(self) if self.id is None else self.id))
+        id_ = id(self) if self.id is None else self.id
+        return hash(self.__name__) ^ hash(id_)
 
     @property
     def _default_values(self):

Reply via email to