8000 gh-133439: Fix the error message in the sqlite3 CLI by StanFromIreland · Pull Request #133807 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 19, 2025
Prev Previous commit
Next Next commit
Merge branch 'main' into sqlite3-fixup
  • Loading branch information
StanFromIreland authored May 10, 2025
commit 69806198372abed2806d3d6bb672f26d9371f91d
5 changes: 3 additions & 2 deletions Lib/sqlite3/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def runsource(self, source, filename="<input>", symbol="single"):
case "":
pass
case _ as unknown:
print("Error: unknown command or invalid arguments:"
f' "{unknown}"', file=sys.stderr)
t = theme.traceback
print(f'{t.type}Error{t.reset}:{t.message} unknown command '
Copy link
Member

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 using self.write(). Why not use it here for consistence?

Copy link
Member Author

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.

Copy link
Member

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 use self.write() too.

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Member Author

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
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0