Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ec921f7

Browse filesBrowse files
Eclips4SonicField
authored andcommitted
pythongh-118817: Fix asyncio REPL on Windows (python#118819)
1 parent f3a362d commit ec921f7
Copy full SHA for ec921f7

File tree

2 files changed

+8
-4
lines changed
Filter options

2 files changed

+8
-4
lines changed

‎Lib/asyncio/__main__.py

Copy file name to clipboardExpand all lines: Lib/asyncio/__main__.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def run(self):
108108
try:
109109
import readline # NoQA
110110
except ImportError:
111-
pass
111+
readline = None
112112

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

@@ -122,8 +122,9 @@ def run(self):
122122
except:
123123
pass
124124
else:
125-
completer = rlcompleter.Completer(console.locals)
126-
readline.set_completer(completer.complete)
125+
if readline is not None:
126+
completer = rlcompleter.Completer(console.locals)
127+
readline.set_completer(completer.complete)
127128

128129
repl_thread = REPLThread()
129130
repl_thread.daemon = True

‎Lib/test/test_repl.py

Copy file name to clipboardExpand all lines: Lib/test/test_repl.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from textwrap import dedent
88
from test import support
99
from test.support import cpython_only, has_subprocess_support, SuppressCrashReport
10-
from test.support.script_helper import kill_python
10+
from test.support.script_helper import kill_python, assert_python_ok
1111
from test.support.import_helper import import_module
1212

1313

@@ -195,6 +195,9 @@ def bar(x):
195195
expected = "(30, None, [\'def foo(x):\\n\', \' return x + 1\\n\', \'\\n\'], \'<stdin>\')"
196196
self.assertIn(expected, output, expected)
197197

198+
def test_asyncio_repl_is_ok(self):
199+
assert_python_ok("-m", "asyncio")
200+
198201

199202

200203
class TestInteractiveModeSyntaxErrors(unittest.TestCase):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.