From 48c9204145e01340d1a41504c54b65032a0d5cc8 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 8 Mar 2021 15:56:44 -0600 Subject: [PATCH] KeyBuilder.rec: return updated key_hash --- pytools/persistent_dict.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pytools/persistent_dict.py b/pytools/persistent_dict.py index 0047aa9..9e961a3 100644 --- a/pytools/persistent_dict.py +++ b/pytools/persistent_dict.py @@ -194,6 +194,16 @@ class KeyBuilder: new_hash = hashlib.sha256 def rec(self, key_hash, key): + """ + :arg key_hash: the hash object to be updated with the hash of *key*. + :arg key: the (immutable) Python object to be hashed. + :returns: the updated *key_hash* + + .. versionchanged:: 2021.2 + + Now returns the updated *key_hash*. + """ + digest = None try: @@ -242,6 +252,7 @@ class KeyBuilder: pass key_hash.update(digest) + return key_hash def __call__(self, key): key_hash = self.new_hash() -- GitLab