https://github.com/python/cpython/commit/ecd83e02b128bf0879d9bb1d3940e40bcb14bdc6 commit: ecd83e02b128bf0879d9bb1d3940e40bcb14bdc6 branch: main author: Stan Ulbrych <89152624+stanfromirel...@users.noreply.github.com> committer: encukou <encu...@gmail.com> date: 2025-06-19T13:46:33+02:00 summary:
gh-133439: Fix the error message in the sqlite3 CLI (GH-133807) Co-authored-by: Bénédikt Tran <10796600+picn...@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storch...@gmail.com> files: M Lib/sqlite3/__main__.py M Lib/test/test_sqlite3/test_cli.py diff --git a/Lib/sqlite3/__main__.py b/Lib/sqlite3/__main__.py index 9e74b49ee828bc..9443afbfcc273f 100644 --- a/Lib/sqlite3/__main__.py +++ b/Lib/sqlite3/__main__.py @@ -63,7 +63,7 @@ def runsource(self, source, filename="<input>", symbol="single"): 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 @@ def runsource(self, source, filename="<input>", symbol="single"): 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 d993e28c4bb3a6..720fa3c4c1ea8b 100644 --- a/Lib/test/test_sqlite3/test_cli.py +++ b/Lib/test/test_sqlite3/test_cli.py @@ -138,7 +138,7 @@ def test_interact_dot_commands_unknown(self): 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) _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com