Skip to content

Fix signature header boundaries and exponent rendering - #9531

Merged
youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/signature-parser-boundaries-20261102
Nov 2, 2026
Merged

youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/signature-parser-boundaries-20261102

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Fix two independent string-processing defects in the shared text-signature machinery:

  • Stop internal signature-header parsing at the first blank paragraph, matching CPython skip_signature. Documentation stripping uses the same boundary check, so malformed headers retain their original docs.
  • Preserve every decimal exponent digit in typed float defaults instead of treating a three-digit exponent as a two-digit one. Reuse the existing integer renderer and retain minimum two-digit padding.

The commits add pure string/formatting unit tests only. They do not construct a VM, change argument binding, alter method-flag semantics, or change Lib tests.

Evidence and scope

The header contract is grounded in CPython 3.15 Objects/typeobject.c.

The exponent bug follows directly from emitting b'0' + exp / 10 as one byte when exp >= 100. Tests cover signed and unsigned one-, two-, and three-digit exponent boundaries and the sizing pass.

These are generic API defects discovered during the whats_left investigation, not yet identified as causes of a specific reported mismatch. This PR is independent of the report-only #9530. It does not implement CPython's method-flag signature fallback or claim full shortest-round-trip float rendering; the existing inaccurate comment about that guarantee is corrected.

Validation

  • Independent source review, normal commit hooks, and git diff --check: passed.
  • Local compile/unit/runtime: not run; dependency-cache/DNS/escalation bootstrap blocker remains.
  • Existing CI, including the added pure unit tests and all normal compatibility suites, is pending on this exact head. Draft until that evidence is available.

codex added 2 commits November 2, 2026 21:00
Match CPython skip_signature header boundaries for both signature exposure and doc stripping. Add pure string tests for malformed headers and valid multiline boundaries.

Assisted-by: OpenAI Codex:model version not exposed
Reuse integer rendering after the exponent sign and minimum two-digit padding. Test decimal exponent boundaries and sizing pass. This does not make the existing float normalization algorithm shortest-round-trip.

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

Keep the same short-circuit header validation and document slice; address the exact collapsible_if failure from Linux Clippy and the WASM check without lint suppression.

Assisted-by: OpenAI Codex:model version not exposed
@youknowone
youknowone marked this pull request as ready for review November 2, 2026 15:23
@youknowone
youknowone merged commit 9d092c5 into RustPython:main Nov 2, 2026
20 checks passed
@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-02T15:27:44.630196Z e96053e 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