mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.13] gh-118817: Fix asyncio REPL
on Windows (GH-118819) (#118847)
(cherry picked from commit c3643a1214
)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
parent
a98e44a5bf
commit
738877a101
2 changed files with 8 additions and 4 deletions
|
@ -108,7 +108,7 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
import readline # NoQA
|
import readline # NoQA
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
readline = None
|
||||||
|
|
||||||
interactive_hook = getattr(sys, "__interactivehook__", None)
|
interactive_hook = getattr(sys, "__interactivehook__", None)
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ if __name__ == '__main__':
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if readline is not None:
|
||||||
completer = rlcompleter.Completer(console.locals)
|
completer = rlcompleter.Completer(console.locals)
|
||||||
readline.set_completer(completer.complete)
|
readline.set_completer(completer.complete)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import subprocess
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from test import support
|
from test import support
|
||||||
from test.support import cpython_only, has_subprocess_support, SuppressCrashReport
|
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
|
from test.support.import_helper import import_module
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,6 +195,9 @@ class TestInteractiveInterpreter(unittest.TestCase):
|
||||||
expected = "(30, None, [\'def foo(x):\\n\', \' return x + 1\\n\', \'\\n\'], \'<stdin>\')"
|
expected = "(30, None, [\'def foo(x):\\n\', \' return x + 1\\n\', \'\\n\'], \'<stdin>\')"
|
||||||
self.assertIn(expected, output, expected)
|
self.assertIn(expected, output, expected)
|
||||||
|
|
||||||
|
def test_asyncio_repl_is_ok(self):
|
||||||
|
assert_python_ok("-m", "asyncio")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TestInteractiveModeSyntaxErrors(unittest.TestCase):
|
class TestInteractiveModeSyntaxErrors(unittest.TestCase):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue