Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatePickler cache is broken: can result in data corruption #66

Open
mdickinson opened this issue Jun 14, 2016 · 1 comment
Open

StatePickler cache is broken: can result in data corruption #66

mdickinson opened this issue Jun 14, 2016 · 1 comment

Comments

@mdickinson
Copy link
Member

mdickinson commented Jun 14, 2016

The StatePickler uses the hash function hash to generate a key for its object cache, at least for hashable objects. Without an extra equality check, this is broken, and leads to different objects with the same hash being treated as the same object.

Example failure resulting from this:

>>> from apptools.persistence.state_pickler import *
>>> loads_state(dumps([(-1, -1), (-2, -2), (-3, -3)]))
[(-1, -1), (-1, -1), (-3, -3)]

Here the error occurs because the tuples (-1, -1) and (-2, -2) have the same hash.

@rkern
Copy link
Member

rkern commented Nov 5, 2018

Another use case for WeakIDDict?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants