From 1389b41e7581a9a1c4e7afe30a5498a8461f3ae0 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 3 Feb 2017 12:02:49 -0600 Subject: [PATCH] Add warning about DiskDict uselessness --- pytools/diskdict.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pytools/diskdict.py b/pytools/diskdict.py index a01ff05..1739afa 100644 --- a/pytools/diskdict.py +++ b/pytools/diskdict.py @@ -81,6 +81,15 @@ class DiskDict(object): self.commit_interval = commit_interval self.commit_countdown = self.commit_interval + from warnings import warn + warn("Given that Python 3+ uses hash randomization, DiskDict will typically " + "be entirely useless and should not be used . Since object hashes " + "will change between runs, it will be unable to retrieve objects " + "from the dictionary in a second run, defeating the purpose of " + "persisting to disk." + "DiskDict is deprecated and will be removed in 2018. " + "Use pytools.persistent_dict instead.", DeprecationWarning, stacklevel=2) + def __contains__(self, key): if key in self.cache: return True -- GitLab