File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Misc/NEWS.d/next/Security Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -497,15 +497,21 @@ def register_readline():
497
497
PYTHON_BASIC_REPL = False
498
498
499
499
import atexit
500
+ import sys
500
501
try :
501
502
import readline
502
503
import rlcompleter # noqa: F401
503
504
if PYTHON_BASIC_REPL :
504
505
CAN_USE_PYREPL = False
505
506
else :
506
- import _pyrepl .readline
507
- import _pyrepl .unix_console
508
- from _pyrepl .main import CAN_USE_PYREPL
507
+ original_path = sys .path
508
+ sys .path = [p for p in original_path if p != '' ]
509
+ try :
510
+ import _pyrepl .readline
511
+ import _pyrepl .unix_console
512
+ from _pyrepl .main import CAN_USE_PYREPL
513
+ finally :
514
+ sys .path = original_path
509
515
except ImportError :
510
516
return
511
517
Original file line number Diff line number Diff line change
1
+ Remove the current directory from sys.path when using pyrepl
You can’t perform that action at this time.
0 commit comments