Skip to content

Match codec and timer signature defaults to Python 3.15 - #9741

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/text-signatures-20261108
Nov 8, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/text-signatures-20261108

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Match the displayed defaults of five native APIs to CPython 3.15.0's Argument Clinic declarations:

  • binascii.hexlify and its b2a_hex alias: bytes_per_sep=1.
  • signal.setitimer: interval=0.0.
  • zlib.compressobj: zdict=<unrepresentable>, not None (an explicit None is rejected).
  • zlib._ZlibDecompressor: the symbolic wbits=MAX_WBITS default.

These changes use the existing FromArgs signature metadata. They preserve optional sentinels, argument conversion order and ownership; no common runtime mechanism or extra argument checks are introduced. The _ZlibDecompressor runtime default remains MAX_WBITS.

The existing signature snippet checks the raw default spellings (normalizing Clinic's line wrapping), inspect's resolved defaults where representable, and omitted-versus-explicit dictionary behavior.

Reference

Compared directly with the generated Clinic headers at CPython v3.15.0:

  • Modules/clinic/binascii.c.h
  • Modules/clinic/signalmodule.c.h
  • Modules/clinic/zlibmodule.c.h

Validation

  • Clean workspace tests and strict Clippy: passed.
  • C API tests and strict Clippy: passed.
  • Clean release build and signature snippet: passed.
  • test_binascii, test_zlib, test_signal, test_inspect: 760 tests, 93 skipped, passed.
  • Existing pytest RustPython signature snippet wrapper: passed.
  • The new assertions fail on the preserved pre-change RustPython binary.

CPython 3.15 execution will be checked by the existing CI snippet job; local comparisons against older CPython versions are not being used as the reference.

codex added 2 commits November 8, 2026 07:38
Assisted-by: OpenAI Codex: model version not exposed
Assisted-by: OpenAI Codex: model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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

@youknowone
youknowone marked this pull request as ready for review November 8, 2026 02:34
@youknowone
youknowone merged commit 8b24ad0 into RustPython:main Nov 8, 2026
28 checks passed
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T02:38:07.189336Z 6e9cd8f 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e9cd8fa39

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to +114
assert zlib._ZlibDecompressor().decompress(zlib.compress(b"signature defaults")) == (
b"signature defaults"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid duplicating the existing zlib round-trip test

This round-trip assertion duplicates ZlibDecompressorTest.testDecompress in Lib/test/test_zlib.py:1051–1065: both compress bytes, construct _ZlibDecompressor() with its defaults, and verify the decompressed result. It adds no signature-specific coverage and violates AGENTS.md's explicit prohibition on adding snippet tests that duplicate Lib/test coverage. Keep the new signature assertions and rely on the existing standard-library test for runtime-default validation.

AGENTS.md reference: AGENTS.md:L119-L119

Useful? React with 👍 / 👎.

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