]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133439: Fix the error message in the sqlite3 CLI (GH-133807)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Thu, 19 Jun 2025 11:46:33 +0000 (12:46 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Jun 2025 11:46:33 +0000 (13:46 +0200)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/sqlite3/__main__.py
Lib/test/test_sqlite3/test_cli.py

index 9e74b49ee828bcc4e1fee512895c0f04b6d619f5..9443afbfcc273fd297520768a5c734320eb70cdb 100644 (file)
@@ -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
index d993e28c4bb3a6a4607bbca907599cbae6679037..720fa3c4c1ea8b56e168c0010b6a784e2e42e04c 100644 (file)
@@ -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)