]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109151: Enable readline in the sqlite3 CLI (GH-109152)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 4 Oct 2023 11:16:44 +0000 (14:16 +0300)
committerGitHub <noreply@github.com>
Wed, 4 Oct 2023 11:16:44 +0000 (14:16 +0300)
Lib/sqlite3/__main__.py
Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst [new file with mode: 0644]

index 3b59763375c147477b303ff468d1ba358e3a39cd..b93b84384a092582455aedde0ea715bcb179dd24 100644 (file)
@@ -116,6 +116,10 @@ def main(*args):
         else:
             # No SQL provided; start the REPL.
             console = SqliteInteractiveConsole(con)
+            try:
+                import readline
+            except ImportError:
+                pass
             console.interact(banner, exitmsg="")
     finally:
         con.close()
diff --git a/Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst b/Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst
new file mode 100644 (file)
index 0000000..78b4e88
--- /dev/null
@@ -0,0 +1 @@
+Enable ``readline`` editing features in the :ref:`sqlite3 command-line interface <sqlite3-cli>` (``python -m sqlite3``).