Skip to content

Align sqlite3 argument declarations with Python 3.15 - #9533

Merged
youknowone merged 5 commits into
RustPython:mainfrom
youknowdot:fix/sqlite-signatures-20261102
Nov 3, 2026
Merged

youknowone merged 5 commits into
RustPython:mainfrom
youknowdot:fix/sqlite-signatures-20261102

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Address the 24 SQLite entries (3 _sqlite3, 21 sqlite3) in the actual Ubuntu whats_left --signature output from #9530, head 68646843423633e60bd54c6d4150db953b303804. That report compares normalized inspect.signature, not raw __text_signature__.

This changes only _sqlite3.rs, using typed declarations rather than overriding displayed signatures:

  • Match Python 3.15's positional/keyword rules for complete_statement, create_function, create_aggregate, and set_progress_handler.
  • Require string backup(name='main'), reject explicit fetchmany(None) while keeping the current arraysize default, and preserve execute's missing-parameters semantics while exposing parameters=().
  • Declare concrete defaults for blob read/seek, setconfig, and setoutputsize; match Clinic's integer/truth conversion for callback tracing, deterministic functions, and connection configuration.
  • Require exactly three positional arguments for Blob.__exit__ and return False.
  • Match the remaining parameter names for Connection/Cursor methods and adapter registration.

Source comparison uses CPython 3.15.0, commit d220409a13b77de7a6c30abe16ea90db01528edc, Modules/_sqlite/{module,connection,cursor,blob}.c and their generated Clinic headers. No Lib, snippet, assertion, shared binder, or workflow changes.

Validation

  • Passed: git diff --check, rustfmt, normal configured pre-commit hooks (merge-conflict check, rustfmt, cspell).
  • Independent source review completed; this is not runtime proof.
  • Not run locally: native compilation, Rust/C-API tests, clippy, test_sqlite3, or RustPython/CPython runtime signature comparison. The local dependency cache/closure is unavailable; this remains Draft pending actual CI.
  • Canonical validation target: cargo run --release --features sqlite -- -m test test_sqlite3 -v, plus required workspace/C-API tests and clippy. The existing keyword tests and expectedFailure markers are unchanged; no pass is claimed from their source alone.
  • Item-level post-fix comparison still needs scripts/whats_left.py --signature on the verified build; main's existing CI invocation currently reports only module counts. No claimed reduction is inferred from those counts.

Existing gaps not claimed fixed

  • Connection.__exit__ still returns None and lacks CPython's rollback/chaining after a failed commit; this patch only renames its parameters.
  • fetchmany/arraysize still use signed c_int rather than CPython's full uint32 range.
  • Renaming adapter-registration arguments does not establish complete converter parity.

AI assistance

Implementation, source comparison, and independent source review were assisted by OpenAI Codex (model version not exposed). Normal hooks ran without bypass. Native runtime verification is outstanding as described above.

Summary by CodeRabbit

  • Bug Fixes
    • SQLite methods now apply consistent argument handling, including support for documented positional and named arguments.
    • Added defaults for the backup database name, blob read length, and blob seek origin.
  • Behavior Changes
    • Cursor array sizes are now non-negative; negative values are rejected.
    • Connection and blob context-manager exit methods accept exception details and return a boolean.

Address all 24 SQLite entries from the actual whats_left Ubuntu signature
report with typed argument declarations, matching parameter names and
defaults. Correct positional/keyword binding, preserve dynamic fetchmany
arraysize and missing execute parameters, and make Blob.__exit__ require
its three arguments and return False.

Source-reviewed against CPython 3.15.0
(d220409a13b77de7a6c30abe16ea90db01528edc). Normal formatting and pre-commit
checks passed; native compile, runtime, clippy and canonical tests were
not run locally because the dependency closure is unavailable. Existing
Connection.__exit__ rollback/return and fetchmany uint32 range gaps remain
outside this patch.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b5c50e7 and 19a79df.

Files ignored due to path filters: 1
  • Lib/test/test_sqlite3/test_regression.py is excluded by !Lib/**
Files selected for processing: 1
  • crates/stdlib/src/_sqlite3.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The _sqlite3 module now defines argument parsing through dedicated FromArgs structs for several functions and methods. The changes update argument rules, defaults, conversions, parameter names, cursor size types, and context-manager exit signatures.

Changes: SQLite API updates

Layer / File(s) Summary
Argument contracts and registration
crates/stdlib/src/_sqlite3.rs
New argument structs define positional and named rules, defaults, and boolean conversion. Statement completeness and function and aggregate registration use the updated arguments.
Connection methods
crates/stdlib/src/_sqlite3.rs
Connection methods forward parsed execution arguments and update callback, configuration, and backup arguments. The backup database name defaults to "main", and Connection.__exit__ uses renamed exception parameters.
Cursor execution and sizing
crates/stdlib/src/_sqlite3.rs
Cursor execution methods use parsed arguments and updated parameter names. arraysize and fetchmany use unsigned sizes, and setoutputsize uses parsed positional arguments.
Blob read, seek, and context exit
crates/stdlib/src/_sqlite3.rs
Blob.read and Blob.seek use parsed arguments with defaults. Blob.__exit__ accepts three exception arguments and returns false.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

Suggested reviewers: youknowone

Merge Risk: Minimal · up to 19a79

No concrete merge-blocking issue was identified. The changes appear mergeable subject to normal build and SQLite test validation.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Align sqlite3 argument declarations with Python 3.15" matches the main change. The raw summary shows that the PR changes SQLite argument parsing (FromArgs structs, defaults, parameter names…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Align sqlite3 argument declarations with Python 3.15" matches the main change. The raw summary shows that the PR changes SQLite argument parsing (FromArgs structs, defaults, parameter names, and types) in crates/stdlib/src/_sqlite3.rs to match the CPython 3.15 signatures. The title is specific and concise, and it names the module and the target version. It does not cover every detail, such as the arraysize type change, but it does not need to.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Print the mismatches already computed by the existing whats_left invocation so the SQLite cohort can be compared with its actual baseline. Reuse the reviewed one-line --signature reporting change from RustPython#9530; no new scan, import, or build is added. Workflow actionlint and zizmor validation remains pending CI.

Assisted-by: OpenAI Codex:model version not exposed
@codspeed

codspeed Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix/sqlite-signatures-20261102 (0fc193e) with main (ef023bc)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Actual macOS CI on 0fc193e reported test_bpo37347 as an unexpected success twice. Its progress-handler n keyword now binds correctly. Regenerate the canonical file through scripts/update_lib migrate with the exact remaining marker metadata, removing only this expectedFailure while preserving both recursive-cursor skips and all test bodies.

Normal pre-commit hooks passed. The original full-suite failure and the new-head validation are separate; native tests were not rerun locally.

Assisted-by: OpenAI Codex:model version not exposed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/sqlite3
[x] test: cpython/Lib/test/test_sqlite3 (TODO: 13)

dependencies:

  • sqlite3

dependent tests: (2 tests)

  • sqlite3: test_dbm_sqlite3 test_sqlite3

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@youknowone
youknowone marked this pull request as ready for review November 2, 2026 15:24
@youknowone
youknowone enabled auto-merge (squash) November 2, 2026 15:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T18:06:30.277830Z 19a79df New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

codex added 2 commits November 3, 2026 01:43
Resolve the Connection.__exit__ overlap by keeping the signature argument names and main rollback/False behavior. Preserve the existing canonical marker retirement and signature diagnostic output.

Assisted-by: OpenAI Codex:model version not exposed
Store arraysize and bind fetchmany size as u32, matching Python 3.15. Preserve the current arraysize fallback and size=1 metadata, and rely on the existing unsigned index converter for negative ValueError and oversized OverflowError. The row loop still grows its result only as rows are returned and does not reserve by the declared limit.

This follow-up depends on the sqlite signature branch at b5c50e7. Independent source review and normal hooks passed; no local native compilation, runtime tests, or allocation-heavy boundary probes were run. Exact error wording and CPython post-error setter storage are not claimed identical.

Assisted-by: OpenAI Codex:model version not exposed
auto-merge was automatically disabled November 2, 2026 18:00

Head branch was pushed to by a user without write access

@youknowone
youknowone merged commit 7f50ac2 into RustPython:main Nov 3, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants