Skip to content
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

Fix 212: Add ability to select UNCHECKED_HASH pyc mode #213

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion distlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,10 @@
compile_kwargs = {}
if hashed_invalidation and hasattr(py_compile,
'PycInvalidationMode'):
if not isinstance(hashed_invalidation, py_compile.PycInvalidationMode):
hashed_invalidation = py_compile.PycInvalidationMode.CHECKED_HASH

Check warning on line 623 in distlib/util.py

View check run for this annotation

Codecov / codecov/patch

distlib/util.py#L623

Added line #L623 was not covered by tests
compile_kwargs[
'invalidation_mode'] = py_compile.PycInvalidationMode.CHECKED_HASH
'invalidation_mode'] = hashed_invalidation
py_compile.compile(path, dpath, diagpath, True,
**compile_kwargs) # raise error
self.record_as_written(dpath)
Expand Down
2 changes: 1 addition & 1 deletion distlib/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def install(self, paths, maker, **kwargs):
installed, and the headers, scripts, data and dist-info metadata are
not written. If kwarg ``bytecode_hashed_invalidation`` is True, written
bytecode will try to use file-hash based invalidation (PEP-552) on
supported interpreter versions (CPython 2.7+).
supported interpreter versions (CPython 3.7+).

The return value is a :class:`InstalledDistribution` instance unless
``options.lib_only`` is True, in which case the return value is ``None``.
Expand Down