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 — fix(sqlite): produce correct error for surrogate characters by ever0de · Pull Request #5962 · RustPython/RustPython

Conversation

@ever0de

@ever0de ever0de commented Jul 13, 2025 •
edited by coderabbitai Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for string processing in SQLite integration, providing more accurate Unicode error reporting.

Sorry, something went wrong.

Uh oh!

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

All reactions
@coderabbitai

coderabbitai Bot commented Jul 13, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Walkthrough

The internal implementation of the str_to_ptr_len function in stdlib/src/sqlite.rs was updated to use try_to_str(vm) for UTF-8 string extraction from PyStr, improving error handling by leveraging the VM's result system. Variable names were adjusted to prevent shadowing, with no changes to public interfaces.

Changes

File(s) Change Summary
stdlib/src/sqlite.rs Updated str_to_ptr_len to use try_to_str(vm) for string extraction and improved error handling; renamed variables to avoid shadowing.

Poem

A string now checked with greater care,
Errors caught in the VM's lair.
No shadows cast on names anew,
SQLite's code now strong and true.
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ab7aa2 and 7b3bdfa.

⛔ Files ignored due to path filters (1)
  • Lib/test/test_sqlite3/test_userfunctions.py is excluded by !Lib/**
📒 Files selected for processing (1)
  • stdlib/src/sqlite.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .github/copilot-instructions.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run rust tests (windows-latest)
🔇 Additional comments (1)
stdlib/src/sqlite.rs (1)

2967-2973: LGTM! Improved error handling for surrogate characters.

The change from s.to_str() to s.try_to_str(vm) properly integrates UTF-8 validation with the VM's error handling system. This will produce more appropriate error messages when encountering invalid UTF-8 sequences like surrogate characters, directly addressing the PR objective. The variable renaming from s to s_str also prevents shadowing and improves code clarity.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
All reactions

Sorry, something went wrong.

Uh oh!

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

@ever0de
fix(sqlite): produce correct error for surrogate characters
7b3bdfa
@ever0de
ever0de force-pushed the fix/sqlite-surrogate-error branch from a7f58ee to 7b3bdfa Compare July 13, 2025 14:45
@ever0de ever0de changed the title fix(sqlite): align surrogate pair error handling with CPython fix(sqlite): produce correct error for surrogate characters Jul 13, 2025
@ever0de
ever0de marked this pull request as ready for review July 13, 2025 14:54
youknowone
youknowone approved these changes Jul 14, 2025
View reviewed changes

@youknowone youknowone 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.

👍

Sorry, something went wrong.

Uh oh!

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

All reactions
@youknowone
youknowone merged commit d42e8f0 into RustPython:main Jul 14, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jul 14, 2025
Introduce PyUtf8Str and fix(sqlite): validate surrogates in SQL statements #5969
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jul 21, 2025
Enforce valid UTF-8 encoding for sqlite collation names #6015
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 2025
Refactor PyUtf8Str #6047
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Dec 23, 2025
Fix compilation error in libsqlite3-sys upgrade (#6467) #6471
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

2 participants

@ever0de @youknowone
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 01402520 — 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.