Skip to content

[3.13] gh-125140: Remove the current directory from sys.path when using pyrepl (GH-125212) #125224

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 1 commit into from
Oct 10, 2024
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
11 changes: 8 additions & 3 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,14 @@ def register_readline():
if PYTHON_BASIC_REPL:
CAN_USE_PYREPL = False
else:
import _pyrepl.readline
import _pyrepl.unix_console
from _pyrepl.main import CAN_USE_PYREPL
original_path = sys.path
sys.path = [p for p in original_path if p != '']
try:
import _pyrepl.readline
import _pyrepl.unix_console
from _pyrepl.main import CAN_USE_PYREPL
finally:
sys.path = original_path
except ImportError:
return

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the current directory from ``sys.path`` when using PyREPL.
Loading