python3{5,6}: Reintroduce bytecode determinism
Originally introduced in8970a9cand1531b5e, these patches were lost inefbe87fwhen the CPython version files were merged, likely due to CPython 3.7 not needing them anymore. These patches should remain in-tree until CPython 3.5 and 3.6 support is dropped completely. Found with the diffoscope ( https://diffoscope.org/ ).
This commit is contained in:
committed by
Frederik Rietdijk
parent
e53ade7dab
commit
28ac309309
@@ -0,0 +1,17 @@
|
||||
--- a/Lib/py_compile.py
|
||||
+++ b/Lib/py_compile.py
|
||||
@@ -139,3 +139,4 @@
|
||||
source_stats = loader.path_stats(file)
|
||||
+ source_mtime = 1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime']
|
||||
bytecode = importlib._bootstrap_external._code_to_bytecode(
|
||||
- code, source_stats['mtime'], source_stats['size'])
|
||||
+ code, source_mtime, source_stats['size'])
|
||||
--- a/Lib/importlib/_bootstrap_external.py
|
||||
+++ b/Lib/importlib/_bootstrap_external.py
|
||||
@@ -485,5 +485,5 @@
|
||||
if source_stats is not None:
|
||||
try:
|
||||
- source_mtime = int(source_stats['mtime'])
|
||||
+ source_mtime = 1
|
||||
except KeyError:
|
||||
pass
|
||||
Reference in New Issue
Block a user