https://github.com/python/cpython/commit/d86ad870cc112d4bd36165398368826746555730
commit: d86ad870cc112d4bd36165398368826746555730
branch: main
author: Frost Ming <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-10-18T20:05:24+05:30
summary:

gh-140251: colorize import statement formatting in asyncio console (#140252)

files:
A Misc/NEWS.d/next/Library/2025-10-17-12-33-01.gh-issue-140251.esM-OX.rst
M Lib/asyncio/__main__.py

diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py
index 10bfca3cf96b3e..d078ebfa4cedbe 100644
--- a/Lib/asyncio/__main__.py
+++ b/Lib/asyncio/__main__.py
@@ -107,7 +107,10 @@ def run(self):
             if CAN_USE_PYREPL:
                 theme = get_theme().syntax
                 ps1 = f"{theme.prompt}{ps1}{theme.reset}"
-            console.write(f"{ps1}import asyncio\n")
+                import_line = f'{theme.keyword}import{theme.reset} asyncio'
+            else:
+                import_line = "import asyncio"
+            console.write(f"{ps1}{import_line}\n")
 
             if CAN_USE_PYREPL:
                 from _pyrepl.simple_interact import (
diff --git 
a/Misc/NEWS.d/next/Library/2025-10-17-12-33-01.gh-issue-140251.esM-OX.rst 
b/Misc/NEWS.d/next/Library/2025-10-17-12-33-01.gh-issue-140251.esM-OX.rst
new file mode 100644
index 00000000000000..cb08e02429b229
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-10-17-12-33-01.gh-issue-140251.esM-OX.rst
@@ -0,0 +1 @@
+Colorize the default import statement ``import asyncio`` in asyncio REPL.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to