GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-133439: Fix the error message in the sqlite3 CLI by StanFromIreland · Pull Request #133807 · python/cpython

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented May 10, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Use print for file consistency
  • Actually test for the full improved error message
  • Correct error message, messages do not have the '.'

Request: @erlend-aasland

  • Issue: sqlite3 CLI does not recognize dot commands with trailing spaces #133439

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@StanFromIreland
Fixup pr
6b59a0b
@StanFromIreland
StanFromIreland requested review from berkerpeksag and erlend-aasland as code owners May 10, 2025 07:37
@bedevere-app bedevere-app Bot mentioned this pull request May 10, 2025
sqlite3 CLI does not recognize dot commands with trailing spaces #133439
Closed
@bedevere-app bedevere-app Bot added the awaiting review label May 10, 2025
@StanFromIreland
Merge branch 'main' into sqlite3-fixup
6980619
@StanFromIreland StanFromIreland mentioned this pull request May 10, 2025
gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line sqlite statements in the sqlite3 command-line interface #133440
Merged
picnixz
picnixz reviewed May 10, 2025
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StanFromIreland

StanFromIreland commented May 10, 2025

Copy link
Copy Markdown
Member Author

Should the error message not be consistent with all other cpython error messages?

I think it is still better to use print for clarity (we don't have to look it up) and consistency, all other writing in the file is done so.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented May 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I think it is still better to use print for clarity (we don't have to look it up) and consistency, all other writing in the file is done so.

I guess so. I actually expected InteractiveConsole to have a write_stderr and a write_stdout but there's none, so maybe only using print makes sense. WDYT @erlend-aasland?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz added the skip news label May 10, 2025
@picnixz picnixz changed the title gh-133439: Fixup sqlite3 changes in 133440 gh-133439: simplify how errors are reported by sqlite3 CLI May 10, 2025
picnixz
picnixz reviewed May 10, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_sqlite3/test_cli.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Benedikts suggestion
6cb0432
picnixz
picnixz reviewed May 10, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland @picnixz
Update Lib/sqlite3/__main__.py
1c6cf80
Co-authored-by: Bénédikt Tran <[email protected]>
@StanFromIreland
StanFromIreland requested a review from picnixz May 10, 2025 08:34
picnixz
picnixz approved these changes May 10, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 10, 2025
@picnixz picnixz added the needs backport to 3.14 bugs and security fixes label May 10, 2025
@StanFromIreland

StanFromIreland commented Jun 12, 2025

Copy link
Copy Markdown
Member Author

While working on something else I realized the current error message is error-ed even more:

sqlite> .HELP 
Error: unknowncommand or invalid arguments:  "HELP".

Friendly ping @erlend-aasland

erlend-aasland reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland mentioned this pull request Jun 13, 2025
Colorize sqlite3 CLI #133447
Closed
@erlend-aasland erlend-aasland self-assigned this Jun 13, 2025
erlend-aasland
erlend-aasland approved these changes Jun 13, 2025
View reviewed changes
@erlend-aasland

erlend-aasland commented Jun 13, 2025

Copy link
Copy Markdown
Contributor

Stan, did you want to include further amendments in this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Jun 13, 2025

Copy link
Copy Markdown
Member Author

I don't mind, I can include it here. All that is to be done for the . help is to just use .rstrip instead of .strip.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Use rstrip
97d002d
serhiy-storchaka
serhiy-storchaka reviewed Jun 13, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Adding the test file would be a good idea
c2ed7f1
StanFromIreland added 2 commits June 13, 2025 18:33
@StanFromIreland
Revert "Use rstrip"
7170ad9
This reverts commit 97d002d.
@StanFromIreland
Revert "Adding the test file would be a good idea"
fed7c0a
This reverts commit c2ed7f1.
@StanFromIreland
StanFromIreland requested a review from serhiy-storchaka June 13, 2025 17:34
serhiy-storchaka
serhiy-storchaka reviewed Jun 13, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Outdated
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 '

@serhiy-storchaka serhiy-storchaka Jun 13, 2025

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@StanFromIreland StanFromIreland Jun 13, 2025

Copy link
Copy Markdown
Member Author

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@serhiy-storchaka serhiy-storchaka Jun 13, 2025

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@serhiy-storchaka serhiy-storchaka Jun 13, 2025

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@StanFromIreland StanFromIreland Jun 13, 2025

Copy link
Copy Markdown
Member Author

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka serhiy-storchaka changed the title gh-133439: simplify how errors are reported by sqlite3 CLI gh-133439: Fix the error message in the sqlite3 CLI Jun 13, 2025
serhiy-storchaka
serhiy-storchaka reviewed Jun 14, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka
serhiy-storchaka reviewed Jun 14, 2025
View reviewed changes
Comment thread Lib/test/test_sqlite3/test_cli.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
Apply suggestions from code review
e8fde8d
serhiy-storchaka
serhiy-storchaka reviewed Jun 14, 2025
View reviewed changes
Comment thread Lib/test/test_sqlite3/test_cli.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
Update Lib/test/test_sqlite3/test_cli.py
4dcd379
@StanFromIreland StanFromIreland mentioned this pull request Jun 19, 2025
gh-133934: Improve sqlite3 .help message #135224
Merged
@encukou
encukou merged commit ecd83e0 into python:main Jun 19, 2025
@miss-islington-app

miss-islington-app Bot commented Jun 19, 2025

Copy link
Copy Markdown

Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 19, 2025
@miss-islington-app

miss-islington-app Bot commented Jun 19, 2025

Copy link
Copy Markdown

Sorry, @StanFromIreland and @encukou, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker ecd83e02b128bf0879d9bb1d3940e40bcb14bdc6 3.14
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned encukou and unassigned erlend-aasland Jun 19, 2025
@encukou encukou assigned StanFromIreland and unassigned encukou Jun 19, 2025
@StanFromIreland

StanFromIreland commented Jun 19, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

The original was "backported" to 3.13 but it seems it was modified:

cpython/Lib/sqlite3/__main__.py

Lines 64 to 65 in 55a34a1

self.write("Error: unknown command or invalid arguments:"
f' "{unknown}".\n')

@encukou Should we backport this (to 3.13) too so they are the same?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

bedevere-app Bot commented Jun 19, 2025

Copy link
Copy Markdown

GH-135708 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 19, 2025
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Jun 19, 2025
@StanFromIreland @picnixz @serhiy-storchaka
[3.14] pythongh-133439: Fix the error message in the sqlite3 CLI (pyt…
33531dd
…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]>
@StanFromIreland
StanFromIreland deleted the sqlite3-fixup branch June 19, 2025 12:33
@encukou

encukou commented Jun 19, 2025

Copy link
Copy Markdown
Member

Now that I look at the diff, I don't see a bug to fix in 3.14.

StanFromIreland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Jun 19, 2025

Copy link
Copy Markdown
Member Author

There is no bug because the author modified the backport, the message is different though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lkollar pushed a commit to lkollar/cpython that referenced this pull request Jun 19, 2025
@StanFromIreland @picnixz
@serhiy-storchaka @lkollar
pythongh-133439: Fix the error message in the sqlite3 CLI (pythonGH-1…
f7dd010
…33807)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@StanFromIreland @picnixz
@serhiy-storchaka @Pranjal095
pythongh-133439: Fix the error message in the sqlite3 CLI (pythonGH-1…
7179095
…33807)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@StanFromIreland @picnixz
@serhiy-storchaka @taegyunkim
pythongh-133439: Fix the error message in the sqlite3 CLI (pythonGH-1…
31b9dc4
…33807)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
@StanFromIreland @picnixz
@serhiy-storchaka @Agent-Hellboy
pythongh-133439: Fix the error message in the sqlite3 CLI (pythonGH-1…
1458384
…33807)

Co-authored-by: Bénédikt Tran <[email protected]>
Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka left review comments
@picnixz picnixz picnixz approved these changes
@erlend-aasland erlend-aasland erlend-aasland approved these changes
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@StanFromIreland StanFromIreland

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@StanFromIreland @picnixz @erlend-aasland @encukou @serhiy-storchaka
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.