[Python-checkins] gh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)

erlend-aasland webhook-mailer at python.org
Thu Apr 27 15:23:26 EDT 2023


https://github.com/python/cpython/commit/8def5ef0160979c05a20f35b143d2314e639982b
commit: 8def5ef0160979c05a20f35b143d2314e639982b
branch: main
author: Erlend E. Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-04-27T21:23:10+02:00
summary:

gh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)

The prompt will still be incorrect in IDLE on Windows,
as IDLE uses CTRL-D for EOF on all platforms.

files:
A Misc/NEWS.d/next/Library/2023-04-27-00-05-32.gh-issue-102628.X230E-.rst
M Lib/sqlite3/__main__.py

diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py
index f8a5cca24e56..9f57e7d6d58c 100644
--- a/Lib/sqlite3/__main__.py
+++ b/Lib/sqlite3/__main__.py
@@ -94,12 +94,13 @@ def main():
         db_name = repr(args.filename)
 
     # Prepare REPL banner and prompts.
+    eofkey = "CTRL-Z" if sys.platform == "win32" else "CTRL-D"
     banner = dedent(f"""
         sqlite3 shell, running on SQLite version {sqlite3.sqlite_version}
         Connected to {db_name}
 
         Each command will be run using execute() on the cursor.
-        Type ".help" for more information; type ".quit" or CTRL-D to quit.
+        Type ".help" for more information; type ".quit" or {eofkey} to quit.
     """).strip()
     sys.ps1 = "sqlite> "
     sys.ps2 = "    ... "
diff --git a/Misc/NEWS.d/next/Library/2023-04-27-00-05-32.gh-issue-102628.X230E-.rst b/Misc/NEWS.d/next/Library/2023-04-27-00-05-32.gh-issue-102628.X230E-.rst
new file mode 100644
index 000000000000..eaaca5b41ba5
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-04-27-00-05-32.gh-issue-102628.X230E-.rst
@@ -0,0 +1,2 @@
+Substitute CTRL-D with CTRL-Z in :mod:`sqlite3` CLI banner when running on
+Windows.



More information about the Python-checkins mailing list