Skip to content
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
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.

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