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

Remove prepended sys.path #11954

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Remove prepended sys.path #11954

merged 2 commits into from
Mar 4, 2025

Conversation

konstin
Copy link
Member

@konstin konstin commented Mar 4, 2025

We prepend the interpreter discovery in a temporary path to sys.path, which we have to strip to avoid the sys.path value containing a then-deleted temp dir.

@konstin konstin added the bug Something isn't working label Mar 4, 2025
@charliermarsh
Copy link
Member

Can you explain this in a bit more detail? What is the temporary path? How does it get added? I thought we ran with -I.

@konstin
Copy link
Member Author

konstin commented Mar 4, 2025

It happens here:

let script = format!(
r#"import sys; sys.path = ["{}"] + sys.path; from python.get_interpreter_info import main; main()"#,
tempdir.path().escape_for_python()
);

@charliermarsh
Copy link
Member

Great, thanks! Can you expand the comment to explain (in get_interpreter_info.py) that this is the path containing the script itself, and we add it so that it can be imported, etc.?

@konstin konstin enabled auto-merge (squash) March 4, 2025 15:53
@konstin konstin merged commit 12f8d6f into main Mar 4, 2025
73 checks passed
@konstin konstin deleted the konsti/remove-prepended-sys-path branch March 4, 2025 16:00
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.

2 participants