Skip to content

Commit e561e4f

Browse files
ambvSonicField
authored andcommitted
pythongh-118628: Don't display pyrepl warning on Windows (python#118665)
1 parent 645dee3 commit e561e4f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/_pyrepl/__main__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import os
22
import sys
33

4-
CAN_USE_PYREPL = True
4+
CAN_USE_PYREPL = sys.platform != "win32"
5+
56

67
def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
78
global CAN_USE_PYREPL
@@ -21,7 +22,7 @@ def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
2122
sys.ps1 = ">>> "
2223
if not hasattr(sys, "ps2"):
2324
sys.ps2 = "... "
24-
#
25+
2526
run_interactive = None
2627
try:
2728
import errno
@@ -33,7 +34,10 @@ def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
3334
from .simple_interact import run_multiline_interactive_console
3435
run_interactive = run_multiline_interactive_console
3536
except Exception as e:
36-
print(f"warning: can't use pyrepl: {e}", file=sys.stderr)
37+
from .trace import trace
38+
msg = f"warning: can't use pyrepl: {e}"
39+
trace(msg)
40+
print(msg, file=sys.stderr)
3741
CAN_USE_PYREPL = False
3842
if run_interactive is None:
3943
return sys._baserepl()

0 commit comments

Comments
 (0)