-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this PR is needed anymore, except maybe for the assertIn
Should the error message not be consistent with all other cpython error messages? I think it is still better to use |
I guess so. I actually expected |
Co-authored-by: Bénédikt Tran <[email protected]>
While working on something else I realized the current error message is error-ed even more:
Friendly ping @erlend-aasland |
Stan, did you want to include further amendments in this PR? |
I don't mind, I can include it here. All that is to be done for the |
Lib/sqlite3/__main__.py
Outdated
@@ -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 ' |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @StanFromIreland and @encukou, I could not cleanly backport this to
|
The original was "backported" to 3.13 but it seems it was modified: cpython/Lib/sqlite3/__main__.py Lines 64 to 65 in 55a34a1
@encukou Should we backport this (to 3.13) too so they are the same? |
GH-135708 is a backport of this pull request to the 3.14 branch. |
…honGH-133807) (cherry picked from commit ecd83e0) Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
Now that I look at the diff, I don't see a bug to fix in 3.14. |
There is no bug because the author modified the backport, the message is different though. |
…33807) Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
print
for file consistencyRequest: @erlend-aasland