[issue29535] datetime hash is deterministic in some cases

Christian Heimes report at bugs.python.org
Sat Feb 11 11:06:01 EST 2017


Christian Heimes added the comment:

I only checked Python 2.7. For Python 3.x it's a bit more complicated:

timedelta: PyObject_Hash(), always the same hash value
date: _Py_HashBytes(), always a randomized hash value
time: _Py_HashBytes() for offset = None, PyObject_Hash() for offset != 0
datetime: _Py_HashBytes() for offset = None, PyObject_Hash() for offset != 0
timezone: PyObject_Hash() (inherited from object)

I don't know why the datetime module doesn't use hash randomization for datetime and time objects with an offset. MAL is the master of (date)time. He might know.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29535>
_______________________________________


More information about the Python-bugs-list mailing list