diff --git a/python/helpers/generator3.py b/python/helpers/generator3.py index 05e09ef115c9..16f412588447 100644 --- a/python/helpers/generator3.py +++ b/python/helpers/generator3.py @@ -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): diff --git a/python/helpers/tests/.gitattributes b/python/helpers/tests/.gitattributes new file mode 100644 index 000000000000..ce93867e18d3 --- /dev/null +++ b/python/helpers/tests/.gitattributes @@ -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 \ No newline at end of file