Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r90071:af772545b69c
Date: 2017-02-12 18:22 +0100
http://bitbucket.org/pypy/pypy/changeset/af772545b69c/

Log:    Fix time.__hash__

diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py
--- a/lib-python/3/datetime.py
+++ b/lib-python/3/datetime.py
@@ -1151,11 +1151,13 @@
             # tzoff, that is.  If we have tzoff then CPython's hashes
             # are again deterministic.  I have no clue why.  We'll go
             # for now for also being nondeterministic in this case.
-            temp1 = '%d@%d@%d@%d@%s' % (self._hour,
-                                        self._minute,
-                                        self._second,
-                                        self._microsecond,
-                                        self.utcoffset())
+            myhhmm = self._hour * 60 + self._minute
+            myoffset = self.utcoffset()
+            if myoffset is not None:
+                myhhmm -= myoffset // timedelta(minutes=1)
+            temp1 = '%d@%d@%d' % (myhhmm,
+                                  self._second,
+                                  self._microsecond)
             self._hashcode = hash(temp1)
         return self._hashcode
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to