Skip to content

Fix reported regex and struct text signatures - #9534

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/re-struct-signatures-20261102
Nov 3, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/re-struct-signatures-20261102

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix 13 signature mismatches reported by whats_left --signature in #9530: six re.Pattern methods, two bound aliases in fractions, and five _struct APIs.

  • Render the existing StringPos(0) default through typed metadata; preserve integer conversion, negative-position clamping, and endpos=sys.maxsize.
  • Name packing varargs values and module format parameters format.
  • Derive Struct(format) from its typed initializer, retaining the implicit-initialization bypass before argument binding in slot_init.
  • Add three pure Rust tests against generated native docs (seven regex methods including the match alias, Struct, and four packing functions).
  • Reuse Align builtin signatures exposed by whats_left #9530's one-line CI --signature output flag. No new scan, import, or build step.

Reference: CPython 3.15.0 d220409a13b77de7a6c30abe16ea90db01528edc, Modules/_sre/clinic/sre.c.h, Modules/clinic/_struct.c.h, and _struct.c::s_init.

Verified results

At head 9f565fc8c91a1efcdd3ab5630993cd6a325930b5, CI run 41454455490 completed successfully: all 24 jobs passed. CodSpeed also passed; pyperformance was skipped by its existing conditions.

Same-platform normalized inspect.signature mismatches versus #9530's report-only head 68646843423633e60bd54c6d4150db953b303804:

Platform Before After Removed Added
Ubuntu 127 114 13 0
macOS 114 101 13 0
Windows 200 187 13 0

Each platform removes exactly the same 13 targeted entries. This compares normalized signatures, not raw text alone.

  • All three new native metadata tests passed on all three operating systems.
  • All three native runtime jobs passed, including existing test_re, test_struct, test_fractions, and test.test_inspect.test_inspect suites.
  • All Rust, clippy, WASM, cross-target, Miri, docs, and lint/zizmor jobs passed. Separate Linux/macOS C-API test results were 129 passed, 4 ignored each. Existing skips/ignores remain; no no-skip claim is made.
  • Local configured hooks and git diff --check passed. Native compilation/runtime validation was performed by CI, not locally.
  • CI caught a test-only trait-owner compilation error in the first head. Follow-up commit 9f565fc8 selects the Pattern payload's generated metadata; every assertion remains intact. The corrected head above is fully green.

Integration note: the NameValues export shares an import-list hunk with the concurrent builtin-signature cohort's NameObjects; retain both names when combining.

AI assistance

Implementation, tests, source analysis, CI investigation, and this description were AI-assisted using OpenAI Codex (model version not exposed). No Lib tests, assertions, or snippets were changed.

Render the existing StringPos zero default from its typed value, use named variadic values for struct packing, and derive the Struct constructor signature from its typed initializer while retaining deferred binding in slot_init. Add pure generated-metadata tests and expose existing whats_left signature warnings in CI. Native builds and runtime tests remain pending CI.

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

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@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/re-struct-signatures-20261102 (71d157d) 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. ↩

Fix the E0277 found by Windows CI: pyclass implements PyClassImpl for Pattern, forwarding the wrapped method definitions. Keep every metadata assertion unchanged.

Assisted-by: OpenAI Codex:model version not exposed
@youknowone
youknowone marked this pull request as ready for review November 3, 2026 00:23
@youknowone
youknowone merged commit fc10522 into RustPython:main Nov 3, 2026
28 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 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-03T00:26:40.137747Z 9f565fc Draft marked ready
ℹ️ 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.

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