Skip to content

gh-125140: Remove the current directory from sys.path when using pyrepl #125212

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 2 commits into from
Oct 9, 2024

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Oct 9, 2024

import _pyrepl.unix_console
from _pyrepl.main import CAN_USE_PYREPL
finally:
sys.path = original_path
Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed this works fine for PYTHONSTARTUP usage (including manipulating sys.path there) as well as keeps sitecustomize.py and usercustomize.py working. Also confirmed asyncio REPL still works in the aforementioned cases.

@ambv ambv enabled auto-merge (squash) October 9, 2024 22:11
@ambv ambv merged commit c7d5d1d into python:main Oct 9, 2024
37 checks passed
@miss-islington-app
Copy link

Thanks @pablogsal for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2024
…g pyrepl (pythonGH-125212)

(cherry picked from commit c7d5d1d)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Signed-off-by: Pablo Galindo <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Oct 9, 2024

GH-125224 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 9, 2024
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.

3 participants