-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
from pytools.persistent_dict import PersistentDict
import numpy as np
pdict = PersistentDict("pytools-test", safe_sync=True)
pdict[np.nan] = 42
assert pdict[np.nan] == 42$ python t.py
/Users/mdiener/Work/e12test/pytools/pytools/persistent_dict.py:602: CollisionWarning: pytools-test: key collision in cache at '/Users/mdiener/Work/e12test/loopy/xdg-cache/pytools' -- these are sufficiently unlikely that they're often indicative of a broken hash key implementation (that is not considering some elements relevant for equality comparison)
return self.fetch(key)
Traceback (most recent call last):
File "/Users/mdiener/Work/e12test/pytools/t.py", line 8, in <module>
assert pdict[np.nan] == 42
~~~~~^^^^^^^^
File "/Users/mdiener/Work/e12test/pytools/pytools/persistent_dict.py", line 602, in __getitem__
return self.fetch(key)
^^^^^^^^^^^^^^^
File "/Users/mdiener/Work/e12test/pytools/pytools/persistent_dict.py", line 840, in fetch
self._collision_check(key, stored_key)
File "/Users/mdiener/Work/e12test/pytools/pytools/persistent_dict.py", line 552, in _collision_check
raise NoSuchEntryCollisionError(key)
pytools.persistent_dict.NoSuchEntryCollisionError: nan🤦
Perhaps we should also check if the key contains a Nan in the collision check? Are there other cases that could be at issue here (inf seems to be fine)?
cc inducer/loopy#828 [major plot twist!]
Metadata
Metadata
Assignees
Labels
No labels