From 05222982ee7e87678305b4880aa496b6aefa202b Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 8 Sep 2023 19:44:04 +0300 Subject: [PATCH 1/2] gh-109151: Enable readline in the sqlite3 CLI --- Lib/sqlite3/__main__.py | 4 ++++ .../Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst | 1 + 2 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py index 3b59763375c147..b93b84384a0925 100644 --- a/Lib/sqlite3/__main__.py +++ b/Lib/sqlite3/__main__.py @@ -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 index 00000000000000..253b2d3a901486 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst @@ -0,0 +1 @@ +Enable ``readline`` editing feasibilities in the :mod:`sqlite3` CLI. From 6fd1f979e04735b0d4cc1830bef8dfbcc92544a8 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Fri, 15 Sep 2023 10:11:01 +0300 Subject: [PATCH 2/2] Update Misc/NEWS.d/next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst Co-authored-by: Victor Stinner --- .../next/Library/2023-09-08-19-44-01.gh-issue-109151.GkzkQu.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 253b2d3a901486..78b4e882baba96 100644 --- 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 @@ -1 +1 @@ -Enable ``readline`` editing feasibilities in the :mod:`sqlite3` CLI. +Enable ``readline`` editing features in the :ref:`sqlite3 command-line interface ` (``python -m sqlite3``).