8000 gh-118817: Fix `asyncio REPL` on Windows by Eclips4 · Pull Request #118819 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-118817: Fix asyncio REPL on Windows #118819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix asyncio REPL on Windows
  • Loading branch information
8000 Eclips4 committed May 9, 2024
commit 71cd972d9c307cc4c7de213f636596d3bead8cd5
7 changes: 4 additions & 3 deletions Lib/asyncio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def run(self):
try:
import readline # NoQA
except ImportError:
pass
readline = None

interactive_hook = getattr(sys, "__interactivehook__", None)

Expand All @@ -122,8 +122,9 @@ def run(self):
except:
pass
else:
completer = rlcompleter.Completer(console.locals)
readline.set_completer(completer.complete)
if readline is not None:
completer = rlcompleter.Completer(console.locals)
readline.set_completer(completer.complete)

repl_thread = REPLThread()
repl_thread.daemon = True
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from textwrap import dedent
from test import support
from test.support import cpython_only, has_subprocess_support, SuppressCrashReport
from test.support.script_helper import kill_python
from test.support.script_helper import kill_python, assert_python_ok
from test.support.import_helper import import_module


Expand Down Expand Up @@ -194,6 +194,10 @@ def bar(x):
self.assertEqual(p.returncode, 0)
expected = "(30, None, [\'def foo(x):\\n\', \' return x + 1\\n\', \'\\n\'], \'<stdin>\')"
self.assertIn(expected, output, expected)

def test_asyncio_repl_is_ok(self):
assert_python_ok("-m", "asyncio")




Expand Down
Loading
0