From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:46:33 +0000 (+0100) Subject: gh-133439: Fix the error message in the sqlite3 CLI (GH-133807) X-Git-Tag: v3.15.0a1~1250 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ecd83e02b128bf0879d9bb1d3940e40bcb14bdc6;p=thirdparty%2FPython%2Fcpython.git gh-133439: Fix the error message in the sqlite3 CLI (GH-133807) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py index 9e74b49ee828..9443afbfcc27 100644 --- a/Lib/sqlite3/__main__.py +++ b/Lib/sqlite3/__main__.py @@ -63,7 +63,7 @@ class SqliteInteractiveConsole(InteractiveConsole): if source[0] == ".": match source[1:].strip(): case "version": - print(f"{sqlite3.sqlite_version}") + print(sqlite3.sqlite_version) case "help": print("Enter SQL code and press enter.") case "quit": @@ -72,8 +72,8 @@ class SqliteInteractiveConsole(InteractiveConsole): pass case _ as unknown: t = theme.traceback - self.write(f'{t.type}Error{t.reset}:{t.message} unknown' - f'command or invalid arguments: "{unknown}".\n{t.reset}') + self.write(f'{t.type}Error{t.reset}: {t.message}unknown ' + f'command: "{unknown}"{t.reset}\n') else: if not sqlite3.complete_statement(source): return True diff --git a/Lib/test/test_sqlite3/test_cli.py b/Lib/test/test_sqlite3/test_cli.py index d993e28c4bb3..720fa3c4c1ea 100644 --- a/Lib/test/test_sqlite3/test_cli.py +++ b/Lib/test/test_sqlite3/test_cli.py @@ -138,7 +138,7 @@ class InteractiveSession(unittest.TestCase): self.assertEndsWith(out, self.PS1) self.assertEqual(out.count(self.PS1), 2) self.assertEqual(out.count(self.PS2), 0) - self.assertIn("Error", err) + self.assertIn('Error: unknown command: "', err) # test "unknown_command" is pointed out in the error message self.assertIn("unknown_command", err)