8000 bpo-40495: compileall option to hardlink duplicate pyc files by frenzymadness · Pull Request #19901 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40495: compileall option to hardlink duplicate pyc files #19901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 14, 2020
Merged
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
frenzymadness committed May 12, 2020
commit 97b057edc7165492522ba0226cd40296c51c5ec5
9 changes: 8 additions & 1 deletion Lib/test/test_compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,12 @@ def test_hardlink_deduplication_same_bytecode(self):

pycs = {}
for opt_level in opt_combination:
# We need this because importlib.util.cache_from_source
# produces different results when called with
# optimization=0 and without optimization
optimization_kwarg = {"optimization": opt_level} if opt_level > 0 else {}
pycs[opt_level] = importlib.util.cache_from_source(
simple_script, optimization=opt_level
simple_script, **optimization_kwarg
)

compileall.compile_dir(
Expand All @@ -415,6 +419,9 @@ def test_hardlink_deduplication_same_bytecode(self):
for pair in itertools.combinations(opt_combination, 2):
self.assertFalse(self.is_hardlink(pycs[pair[0]], pycs[pair[1]]))

for pyc_file in pycs.values():
os.unlink(pyc_file)

def test_hardlink_deduplication_different_bytecode_all_opt(self):
# "'''string'''\nassert 1" produces a different bytecode for
# all optimization levels
Expand Down
0