mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-125140: Remove the current directory from sys.path when using pyrepl (GH-125212)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
parent
1877543d03
commit
c7d5d1d93b
2 changed files with 9 additions and 3 deletions
11
Lib/site.py
11
Lib/site.py
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue