summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2024-05-06 19:35:22 (GMT)
committerGitHub <noreply@github.com>2024-05-06 19:35:22 (GMT)
commit9bf00322ba09e2439a78fcec77dc6917e1391e31 (patch)
treebea989db742fdeaf07fb53f45476682f495e59bc
parent67ce820d51d7f4bb7068ed560f4f2e2d83dd30d5 (diff)
downloadcpython-9bf00322ba09e2439a78fcec77dc6917e1391e31.zip
cpython-9bf00322ba09e2439a78fcec77dc6917e1391e31.tar.gz
cpython-9bf00322ba09e2439a78fcec77dc6917e1391e31.tar.bz2
gh-118628: Don't display pyrepl warning on Windows (#118665)
-rw-r--r--Lib/_pyrepl/__main__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/_pyrepl/__main__.py b/Lib/_pyrepl/__main__.py
index 417ee17..c598019 100644
--- a/Lib/_pyrepl/__main__.py
+++ b/Lib/_pyrepl/__main__.py
@@ -1,7 +1,8 @@
import os
import sys
-CAN_USE_PYREPL = True
+CAN_USE_PYREPL = sys.platform != "win32"
+
def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
global CAN_USE_PYREPL
@@ -21,7 +22,7 @@ def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
sys.ps1 = ">>> "
if not hasattr(sys, "ps2"):
sys.ps2 = "... "
- #
+
run_interactive = None
try:
import errno
@@ -33,7 +34,10 @@ def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
from .simple_interact import run_multiline_interactive_console
run_interactive = run_multiline_interactive_console
except Exception as e:
- print(f"warning: can't use pyrepl: {e}", file=sys.stderr)
+ from .trace import trace
+ msg = f"warning: can't use pyrepl: {e}"
+ trace(msg)
+ print(msg, file=sys.stderr)
CAN_USE_PYREPL = False
if run_interactive is None:
return sys._baserepl()