Skip to content

Commit

Permalink
pythongh-118628: Don't display pyrepl warning on Windows (python#118665)
Browse files Browse the repository at this point in the history
  • Loading branch information
ambv authored May 6, 2024
1 parent 67ce820 commit 9bf0032
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Lib/_pyrepl/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit 9bf0032

Please sign in to comment.