mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Secure line ending in .py files used for caching tests
Otherwise, automatic line ending conversion might affect SHA 256 hashes calculated in test data based on its content. It allowed to uniformly compute it both for binary and text files. GitOrigin-RevId: b41ff089235c178b182271a81a26146cff54e053
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d11d689e6b
commit
8d6daccfeb
@@ -377,14 +377,8 @@ def builtin_module_hash(mod_qname):
|
||||
|
||||
|
||||
def physical_module_hash(mod_path):
|
||||
pure_py = os.path.splitext(mod_path)[1] == '.py'
|
||||
if pure_py:
|
||||
# Open .py files in text mode to avoid LF/CRLF conversion issues. It should happen only in tests.
|
||||
with fopen(mod_path, 'r') as f:
|
||||
return sha256_digest(f.read().encode(OUT_ENCODING))
|
||||
else:
|
||||
with fopen(mod_path, 'rb') as f:
|
||||
return sha256_digest(f)
|
||||
with fopen(mod_path, 'rb') as f:
|
||||
return sha256_digest(f)
|
||||
|
||||
|
||||
def version_to_tuple(version):
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# In these files persistent line endings are crucial
|
||||
# as we use their binary content for hashes.
|
||||
generator3_tests/data/SkeletonCaching/**/*.py text eol=lf
|
||||
Reference in New Issue
Block a user