summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2022-07-20 20:26:50 +0200
committerStefan Behnel <stefan_ml@behnel.de>2022-07-20 20:27:17 +0200
commit3cb3c2fd3a1359c46c81675610f7458ac6dcf223 (patch)
tree84c912bf639028f0a4bb7f7a04752c1c88e5a0cb
parent3a373e2ccdddc79202d9ed13edc85d4b95616b26 (diff)
downloadcython-3cb3c2fd3a1359c46c81675610f7458ac6dcf223.tar.gz
Minor code cleanups after 3a373e2ccdddc79202d9ed13edc85d4b95616b26.
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index 5799c4945..0e86d5b0e 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -4,7 +4,8 @@ import cython
cython.declare(PyrexTypes=object, Naming=object, ExprNodes=object, Nodes=object,
Options=object, UtilNodes=object, LetNode=object,
LetRefNode=object, TreeFragment=object, EncodedString=object,
- error=object, warning=object, copy=object, _unicode=object)
+ error=object, warning=object, copy=object, hashlib=object, sys=object,
+ _unicode=object)
import copy
import hashlib
@@ -2132,10 +2133,11 @@ def _calculate_pickle_checksums(member_names):
for algo_name in ['md5', 'sha256', 'sha1']:
try:
mkchecksum = getattr(hashlib, algo_name)
- checksums.append('0x' + mkchecksum(member_names_string, **hash_kwargs).hexdigest()[:7])
+ checksum = mkchecksum(member_names_string, **hash_kwargs).hexdigest()
except (AttributeError, ValueError):
- # The algorithm (i.e. MD5) might not be there at all, or might be blocked at runtime
+ # The algorithm (i.e. MD5) might not be there at all, or might be blocked at runtime.
continue
+ checksums.append('0x' + checksum[:7])
return checksums