mirror of https://github.com/python/cpython
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
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
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Remove the current directory from ``sys.path`` when using PyREPL.
|
Loading…
Reference in New Issue