Skip to content

Skip inferred venv metadata for symlinked base interpreters - #2551

Open
zaniebot wants to merge 2 commits into
automations/reproduce-bug/22383from
zb/fix-symlinked-interpreter-cache
Open

zaniebot wants to merge 2 commits into
automations/reproduce-bug/22383from
zb/fix-symlinked-interpreter-cache

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Venvs created from symlinked Python executables can cache a sys._base_executable that disagrees with Python and changes the base selected for child environments. Let Python populate the cache for these executables on Unix, and invalidate older interpreter-cache entries so existing environments recover after upgrading.

Fixes astral-sh#22383.

Stacked on #2547.

The reproducer is stacked on astral-sh#22524.

@zaniebot
zaniebot deployed to automations October 9, 2026 15:34 — with GitHub Actions Active
@astral-automations-bot astral-automations-bot Bot added the bug Something isn't working label Oct 9, 2026
@zaniebot
zaniebot force-pushed the zb/fix-symlinked-interpreter-cache branch from 4b7a52a to fca9a08 Compare October 9, 2026 15:41
@zaniebot
zaniebot deployed to automations October 9, 2026 15:44 — with GitHub Actions Active
@codspeed

codspeed Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

✅ 54 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing zb/fix-symlinked-interpreter-cache (9edf2dd) with automations/reproduce-bug/22383 (32d694a)

Open in CodSpeed

Footnotes

  1. 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@astral-automations-bot
astral-automations-bot Bot force-pushed the automations/reproduce-bug/22383 branch from 93729c7 to e3272ea Compare October 13, 2026 18:55
@zaniebot
zaniebot force-pushed the zb/fix-symlinked-interpreter-cache branch from fca9a08 to b9275de Compare October 13, 2026 19:01
@zaniebot
zaniebot force-pushed the automations/reproduce-bug/22383 branch from e3272ea to 32d694a Compare October 13, 2026 19:01
@zaniebot
zaniebot deployed to automations October 13, 2026 19:02 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 13, 2026 19:26 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 13, 2026 19:31 — with GitHub Actions Active
Comment on lines +393 to +395
if cfg!(unix) && fs_err::symlink_metadata(&base_python)?.is_symlink() {
Interpreter::clear_cache(self.interpreter().sys_executable(), cache)?;
return Ok(());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Update the sync cache test for the symlink fallback

When tests use system CPython 3.12, TestContext::python_path() exposes it through a python3 symlink, which non-standalone interpreters retain as their base executable. This guard therefore skips cache population in sync_caches_interpreter (crates/uv/tests/sync/sync.rs), causing its second sync to execute sitecustomize.py and fail assert!(!startup_marker.exists()). Make that test’s initial sync explicitly select the canonical regular executable, following create_venv_caches_interpreter, so it continues exercising metadata inference regardless of the contributor’s Python installation.

@zaniebot
zaniebot deployed to automations October 13, 2026 19:52 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
automations — 9edf2dd0 Deployed Oct 13, 2026 by zaniebot via review-code-quality / code quality review #9809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant