Currently hashes of datetime objects are computed lazily as such it causes tsan warning as it is stored non-atomically.
WARNING: ThreadSanitizer: data race (pid=58514)
Read of size 8 at 0x0001104978a0 by thread T18094:
#0 datetime_hash _datetimemodule.c:6603 (python.exe:arm64+0x1003b3cbc)
#1 PyObject_Hash object.c (python.exe:arm64+0x10012b4d8)
#2 setitem_take2_lock_held dictobject.c:2661 (python.exe:arm64+0x1000fb300)
#3 _PyDict_FromItems dictobject.c:2255 (python.exe:arm64+0x1000f9b54)
#4 _PyEval_EvalFrameDefault generated_cases.c.h:1272 (python.exe:arm64+0x10027634c)
#5 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#6 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#7 method_vectorcall classobject.c:65 (python.exe:arm64+0x100084190)
#8 _PyObject_Call call.c:348 (python.exe:arm64+0x10007f8b0)
#9 PyObject_Call call.c:373 (python.exe:arm64+0x10007f9d8)
#10 _PyEval_EvalFrameDefault generated_cases.c.h:2616 (python.exe:arm64+0x10027bf64)
#11 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#12 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#13 method_vectorcall classobject.c:73 (python.exe:arm64+0x10008422c)
#14 context_run context.c:728 (python.exe:arm64+0x1002b53dc)
#15 _PyEval_EvalFrameDefault generated_cases.c.h:3710 (python.exe:arm64+0x10027ffbc)
#16 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#17 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#18 method_vectorcall classobject.c:73 (python.exe:arm64+0x10008422c)
#19 _PyObject_Call call.c:348 (python.exe:arm64+0x10007f964)
#20 PyObject_Call call.c:373 (python.exe:arm64+0x10007f9d8)
#21 thread_run _threadmodule.c:387 (python.exe:arm64+0x10041b338)
#22 pythread_wrapper thread_pthread.h:234 (python.exe:arm64+0x100358824)
Previous write of size 8 at 0x0001104978a0 by thread T18096:
#0 datetime_hash _datetimemodule.c:6629 (python.exe:arm64+0x1003b3f88)
#1 PyObject_Hash object.c (python.exe:arm64+0x10012b4d8)
#2 setitem_take2_lock_held dictobject.c:2661 (python.exe:arm64+0x1000fb300)
#3 _PyDict_FromItems dictobject.c:2255 (python.exe:arm64+0x1000f9b54)
#4 _PyEval_EvalFrameDefault generated_cases.c.h:1272 (python.exe:arm64+0x10027634c)
#5 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#6 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#7 method_vectorcall classobject.c:65 (python.exe:arm64+0x100084190)
#8 _PyObject_Call call.c:348 (python.exe:arm64+0x10007f8b0)
#9 PyObject_Call call.c:373 (python.exe:arm64+0x10007f9d8)
#10 _PyEval_EvalFrameDefault generated_cases.c.h:2616 (python.exe:arm64+0x10027bf64)
#11 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#12 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#13 method_vectorcall classobject.c:73 (python.exe:arm64+0x10008422c)
#14 context_run context.c:728 (python.exe:arm64+0x1002b53dc)
#15 _PyEval_EvalFrameDefault generated_cases.c.h:3710 (python.exe:arm64+0x10027ffbc)
#16 _PyEval_Vector ceval.c:1989 (python.exe:arm64+0x10026ad88)
#17 _PyFunction_Vectorcall call.c (python.exe:arm64+0x10007fcec)
#18 method_vectorcall classobject.c:73 (python.exe:arm64+0x10008422c)
#19 _PyObject_Call call.c:348 (python.exe:arm64+0x10007f964)
#20 PyObject_Call call.c:373 (python.exe:arm64+0x10007f9d8)
#21 thread_run _threadmodule.c:387 (python.exe:arm64+0x10041b338)
#22 pythread_wrapper thread_pthread.h:234 (python.exe:arm64+0x100358824)
Currently hashes of datetime objects are computed lazily as such it causes tsan warning as it is stored non-atomically.
TSAN race:
Linked PRs