You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Hashing of the number 1 and True produces inconsistent results #150
I could kind of narrow it down to a problem where the is a problem with 1 vs True.
Here are the hasing values
Value One 92811594354414759544950280658468913931
True 286821110490183736728180146001011693598
Value Two 272267926099876093035070951265092329942
24 10117690639475950056254465627342521112
Value Three 7710226368046311526055217056590024901
1 286821110490183736728180146001011693598
{'Value One': True, 'Value Two': 24, 'Value Three': 1} 338990766718213272754510958482031841423
Value Two 272267926099876093035070951265092329942
24 10117690639475950056254465627342521112
Value Three 7710226368046311526055217056590024901
1 231678797214551245419120414857003063149
Value One 92811594354414759544950280658468913931
True 231678797214551245419120414857003063149
{'Value Two': 24, 'Value Three': 1, 'Value One': True} 151579104084341967660573380786584663019
See how 1 and True get the same hash value. I the first case the hashing for True happens first and then 1 gets the value for that. In the second case the order is different.
the inconsistent behaviour occur at deephash.py:286 where result = self[obj] fetches the hash if it is already computed but there is no difference between self[1] and self[True]
Activity
Necrophagos commentedon Jul 1, 2019
I could kind of narrow it down to a problem where the is a problem with
1vsTrue.Here are the hasing values
See how
1andTrueget the same hash value. I the first case the hashing forTruehappens first and then1gets the value for that. In the second case the order is different.[-]Weird bug with ignore_order=True[/-][+][Bug] Hashing of the number 1 and True produces inconsistent results[/+]Necrophagos commentedon Jul 1, 2019
This is the issue
the inconsistent behaviour occur at
deephash.py:286whereresult = self[obj]fetches the hash if it is already computed but there is no difference betweenself[1]andself[True]Necrophagos commentedon Jul 1, 2019
Here is a possible solution
0001-Fix-inconsistent-handling-of-bool-and-number.patch.txt
seperman commentedon Jul 12, 2019
Thanks @Necrophagos! Looking into the issue now.
fixing True vs 1 for dictionary keys #150
Merge pull request #152 from seperman/dev
seperman commentedon Jul 15, 2019
Closing this ticket since it is resolved.