mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Keep private cache fixture source bytes consistent on Windows
Write explicit LF for filesystem source so checked-hash ZIP inputs match the same fixture bytes on every platform. Preserve all cache validity and foreign-format rejection assertions. Assisted-by: OpenAI Codex:model identifier unavailable
This commit is contained in:
1 parent
2191a9d0c8
commit
1f1fe045bb
1 file changed
+2
-2
@@ -18,7 +18,7 @@ if sys.implementation.name == "rustpython":
|
|||||||
with tempfile.TemporaryDirectory() as directory:
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
root = Path(directory)
|
root = Path(directory)
|
||||||
source = root / "cache_subject.py"
|
source = root / "cache_subject.py"
|
||||||
source.write_text("value = 41\n", encoding="ascii")
|
source.write_text("value = 41\n", encoding="ascii", newline="\n")
|
||||||
code = compile("value = 42\n", "byte_exact/cache_subject.py", "exec")
|
code = compile("value = 42\n", "byte_exact/cache_subject.py", "exec")
|
||||||
stat = source.stat()
|
stat = source.stat()
|
||||||
headers = [
|
headers = [
|
||||||
@@ -100,7 +100,7 @@ if sys.implementation.name == "rustpython":
|
|||||||
raise AssertionError("foreign ZIP cache accepted")
|
raise AssertionError("foreign ZIP cache accepted")
|
||||||
|
|
||||||
# Explicit py_compile writes under -B; all writers must use the private token.
|
# Explicit py_compile writes under -B; all writers must use the private token.
|
||||||
source.write_text("value = 41\n", encoding="ascii")
|
source.write_text("value = 41\n", encoding="ascii", newline="\n")
|
||||||
explicit = root / "explicit.pyc"
|
explicit = root / "explicit.pyc"
|
||||||
previous = sys.dont_write_bytecode
|
previous = sys.dont_write_bytecode
|
||||||
sys.dont_write_bytecode = True
|
sys.dont_write_bytecode = True
|
||||||
|
|||||||
Reference in new issue
Block a user