Skip to content

Handle a None sys.implementation.cache_tag in install_lib - #5345

Open
officialpm wants to merge 3 commits into
pypa:mainfrom
officialpm:fix/install-lib-no-cache-tag
Open

officialpm wants to merge 3 commits into
pypa:mainfrom
officialpm:fix/install-lib-no-cache-tag

Conversation

@officialpm

Copy link
Copy Markdown

Closes #5344

On Python builds where sys.implementation.cache_tag is None (module caching disabled), install_lib._gen_exclusion_paths fails with a TypeError when it concatenates the tag into the __pycache__ path.

  • Return early when the cache tag is None, next to the existing hasattr(sys, 'implementation') check. There are no bytecode cache files to exclude in that case.
  • Added setuptools/tests/test_install_lib.py. The no-cache-tag test fails without the change.
  • Added a bugfix news fragment.

Tests and ruff pass locally.

@mergify

mergify Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instal_lib does not handle when sys.implementation.cache_tag is None

1 participant