Skip to content

Add checked legacy Python 3.15 text signature overrides - #9756

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/bulk-signatures-20261109
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/bulk-signatures-20261109

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This is the deferred override half requested in #9756 (comment). The generator-supported corrections have been split into #9795, an independent PR to merge first. Both branches are based directly on main.

  • Add an explicit text_signature attribute for legacy signatures that the generator cannot express.
  • Apply it to the 21 str/bytes/bytearray search and prefix/suffix methods with nested optional groups, and to _csv.reader, writer, and register_dialect.
  • Validate overrides against actual binding metadata at compile time: parameter count, requiredness, receiver markers, kinds, keyword names, and known flattened binders. CSV's documented keyword dialect requires a matching optional positional parameter plus an actual keyword collector.
  • Keep the ordinary FromArgs derives, metadata, converters, dispatch, and CSV's delayed validation unchanged. The previous py_optional_group and DefaultRepr::OptionalGroup implementation is removed.

This stays draft for the final text-signature phase. The supported override grammar is intentionally narrow: positional parameters, /, literal defaults, **kwargs, and nested trailing optional groups. Ordinary symbolic/default corrections continue to use the generator.

Validation

At final head 4f745ac05:

  • Configured commit hooks passed.
  • Full workspace Rust tests and doctests passed: 1,549 passed and 20 ignored across their reported groups. This includes compilation of all 24 override annotations and the four real compile-fail rustdoc cases.
  • C-API tests passed: 149 passed, 2 ignored.
  • Strict workspace/all-target and separate C-API Clippy passed.
  • Release build passed.
  • Signature and CSV snippets passed on RustPython and CPython 3.15.1; both selected RustPython pytest cases passed.
  • test_str test_bytes test_inspect test_csv passed: all 4 files, 992 tests run, 77 skipped.
  • Both split branches merge cleanly and preserve all original Python test statements across the two PRs.

All native checks used a clean rebuild of every workspace package. No source fix or additional push was needed after publication. GitHub CI is tracked separately; its final results are not claimed here.

AI assistance

Split, override implementation, review, and validation were performed with Codex. Original grouped-signature and CSV binding regressions are preserved; the CSV invalid-name error-text regression moved with its runtime fix to the independent generated-signature PR.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • 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

@codspeed

codspeed Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix/bulk-signatures-20261109 (4f745ac) with main (dd8c343)

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. ↩

@youknowone

Copy link
Copy Markdown
Member

Please split this PR in two.

1. Signatures that need a text-signature override. This is the py_optional_group part: the sub[, start[, end]] / prefix[, …] / suffix[, …] signatures of the str/bytes/bytearray search and prefix/suffix methods. Clinic cannot generate these; CPython supplies them with @text_signature (e.g. Objects/unicodeobject.c:11493, Objects/bytesobject.c:2012) and shares them through Clinic clones (str.find as unicode_find = str.count). The _csv reader/writer/register_dialect display, which differs from the actual binding, belongs here too. Instead of display-only metadata inside FromArgs (DefaultRepr::OptionalGroup, the PARAMS ≠ BINDING_PARAMS impl), these should use a dedicated override that is checked against the binding at compile time. That will be the last piece of the text-signature work, so we will not merge it now.

2. Everything else, i.e. the signatures the generator can produce: the symbolic py_defaults (array, blake2, codecs, faulthandler, marshal, select, warnings, IO seek), the _imp.create_dynamic and struct-sequence parameter names, the Future/Task add_done_callback context default and callback-context fix, and the CSV error-text correction. Please open this as a separate PR. We will merge it first.

— commented by Claude

@youknowdot
youknowdot force-pushed the fix/bulk-signatures-20261109 branch 2 times, most recently from 2409e56 to 4f745ac Compare November 11, 2026 04:01
@youknowdot youknowdot changed the title Match grouped and symbolic Python 3.15 text signatures in bulk Add checked legacy Python 3.15 text signature overrides Nov 11, 2026
youknowone pushed a commit that referenced this pull request Nov 11, 2026
Split the generator-supported corrections from the legacy display overrides in #9756. Preserve the callback context distinction between omission and explicit None, and fix CSV invalid-name error text.

Assisted-by: OpenAI Codex: model version not exposed
Keep optional-group and CSV display signatures separate from argument binding. Validate explicit overrides against binding metadata in a const context and preserve legacy call behavior.

Assisted-by: OpenAI Codex: model version not exposed
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.

2 participants