Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 9 additions & 8 deletions Lib/asyncio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ def run(self):
global return_code

try:
banner = (
f'asyncio REPL {sys.version} on {sys.platform}\n'
f'Use "await" directly instead of "asyncio.run()".\n'
f'Type "help", "copyright", "credits" or "license" '
f'for more information.\n'
)

console.write(banner)
if not sys.flags.quiet:
banner = (
f'asyncio REPL {sys.version} on {sys.platform}\n'
f'Use "await" directly instead of "asyncio.run()".\n'
f'Type "help", "copyright", "credits" or "license" '
f'for more information.\n'
)

console.write(banner)

if startup_path := os.getenv("PYTHONSTARTUP"):
sys.audit("cpython.run_startup", startup_path)
Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ def test_toplevel_contextvars_async(self):
expected = "toplevel contextvar test: ok"
self.assertIn(expected, output, expected)

def test_quiet_mode(self):
p = spawn_repl("-q", "-m", "asyncio", custom=True)
output = kill_python(p)
self.assertEqual(p.returncode, 0)
self.assertEqual(output[:3], ">>>")


if __name__ == "__main__":
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The :mod:`asyncio` REPL no longer prints copyright and version messages in
the quiet mode (:option:`-q`). Patch by Bartosz Sławecki.
Loading