Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-133439: Fix the error message in the sqlite3 CLI#133807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 10 commits intopython:mainfromStanFromIreland:sqlite3-fixup
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletionsLib/sqlite3/__main__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,7 +61,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":
Expand All@@ -70,8 +70,9 @@ 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}')
print(f'{t.type}Error{t.reset}:{t.message} unknown command '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Note that the banner and tracebacks are written usingself.write(). Why not use it here for consistence?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Errors (35) use print? And so do the other match statements branches.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Other branches output to stdout.

Line 35 perhaps should useself.write() too.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We can leaveexecute() for now. It is not worth to rewrite it just for this.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
print(f'{t.type}Error{t.reset}:{t.message} unknown command '
self.write(f'{t.type}Error{t.reset}:{t.message} unknown command '

It is up to you/Erlend. The box to allow you to commit was checked.

f'or invalid arguments: "{unknown}"{t.reset}',
file=sys.stderr)
else:
if not sqlite3.complete_statement(source):
return True
Expand Down
2 changes: 1 addition & 1 deletionLib/test/test_sqlite3/test_cli.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,7 +130,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 or invalid arguments", err)
# test "unknown_command" is pointed out in the error message
self.assertIn("unknown_command", err)

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp