Bug report
Bug description:
When using python -m asyncio, the REPL does not respect PYTHON_BASIC_REPL=1.
Using a test case from the pyrepl test suite, we can clearly see pyrepl is being used:
|
# The site module must not load _pyrepl if PYTHON_BASIC_REPL is set |
|
commands = ("import sys\n" |
|
"print('_pyrepl' in sys.modules)\n" |
|
"exit()\n") |
|
env["PYTHON_BASIC_REPL"] = "1" |
PYTHON_BASIC_REPL=1 python -m asyncio
asyncio REPL 3.15.0a0 (heads/main:81959a0364, Oct 12 2025, 12:47:58) [GCC 13.3.0] on linux
Use "await" directly instead of "asyncio.run()".
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> import sys
>>> '_pyrepl' in sys.modules
True
Looking at the source of asyncio.__main__, this makes perfect sense, as the asyncio REPL is a customised version of _pyrepl.console.InteractiveColoredConsole:
|
from _pyrepl.console import InteractiveColoredConsole |
|
|
|
from . import futures |
|
|
|
|
|
class AsyncIOInteractiveConsole(InteractiveColoredConsole): |
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Bug report
Bug description:
When using
python -m asyncio, the REPL does not respectPYTHON_BASIC_REPL=1.Using a test case from the pyrepl test suite, we can clearly see pyrepl is being used:
cpython/Lib/test/test_pyrepl/test_pyrepl.py
Lines 1593 to 1597 in 6710156
Looking at the source of
asyncio.__main__, this makes perfect sense, as the asyncio REPL is a customised version of_pyrepl.console.InteractiveColoredConsole:cpython/Lib/asyncio/__main__.py
Lines 16 to 21 in 6710156
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux