Skip to content

Remove redundant concrete signature default overrides - #9558

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:cleanup-main-py-defaults-20261103
Nov 3, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:cleanup-main-py-defaults-20261103

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remove 15 redundant py_default annotations without changing argument types, function bodies, assertions, or rendered Python signatures.

  • Reuse ArgIntoBool::py_default() for 11 existing constant boolean defaults in binascii.
  • Declare four existing Option<T> None defaults directly: both copy_file_range offsets and chmod.dir_fd in posix and posix_compat.
  • Runtime omission and supplied-value conversion stay unchanged. Signature metadata changes from Raw to typed Bool/None, which render the same text. This does not depend on Support Python None defaults in object argument declarations #9557.
  • Preserve symbolic and semantic omission overrides, including binascii alphabets and platform-dependent follow_symlinks.

Source-reviewed against CPython 3.15.0 at d220409a13b77de7a6c30abe16ea90db01528edc: binascii defaults, chmod, and copy_file_range.

Validation

  • Independent exact-head source review passed.
  • Normal pre-commit hooks, rustfmt, and diff checks passed; worktree clean.
  • Exact-head workspace and C-API tests/Clippy, plus canonical test_binascii and test_os, were attempted offline. All stopped before compilation because the pinned parking_lot_core git dependency is unavailable locally. No runtime tests have passed locally; CI remains pending.
  • No Lib files, snippets, test expectations, or global argument-order behavior changed.

AI-assisted implementation and review with OpenAI Codex; model version not exposed.

Summary by CodeRabbit

  • Refactor
    • Updated how optional arguments are declared across encoding and file-system operations. Their available options and runtime behavior remain unchanged, so no user-facing changes are expected.

Reuse ArgIntoBool::py_default for eleven constant booleans, and declare four existing Option None defaults directly. Runtime field types, argument conversion, function bodies, and rendered Python defaults are unchanged. Preserve semantic and symbolic overrides.

Source-reviewed against CPython 3.15.0 d220409a13b77de7a6c30abe16ea90db01528edc. No test assertions or Lib files changed. Native validation remains subject to the available dependency closure.

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

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The changes remove explicit Python-literal defaults from argument declarations in binascii, os, and POSIX modules. The stated native defaults, argument types, and implementations remain unchanged.

Changes: Argument default declarations

Layer / File(s) Summary
Binascii boolean defaults
crates/stdlib/src/binascii.rs
Boolean arguments retain their true or false defaults and no longer specify explicit Python-literal defaults.
OS and POSIX optional defaults
crates/vm/src/stdlib/os.rs, crates/vm/src/stdlib/posix.rs, crates/vm/src/stdlib/posix_compat.rs
Optional offset and directory descriptor arguments use direct None defaults. Their types and implementations remain unchanged.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Refactor

Possibly related PRs

  • RustPython/RustPython#9536: Updates the same CopyFileRangeArgs and ChmodArgs declarations; this PR continues that signature work.
  • RustPython/RustPython#9561: Also preserves native argument defaults, and extends the approach to PySsize and compression arguments.

Suggested reviewers: youknowone

Merge Risk: Minimal · up to ae0c7

The annotation cleanup preserves argument behavior and displayed defaults. No actionable merge-blocking issue was identified; normal CI validation remains pending.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: removing redundant concrete signature default overrides.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. 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 0 functions across 4 files.

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

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/python/security/http-response-from-request.yml

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.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 7ac18a1 and ae0c720.

Files selected for processing: 4
  • crates/stdlib/src/binascii.rs
  • crates/vm/src/stdlib/os.rs
  • crates/vm/src/stdlib/posix.rs
  • crates/vm/src/stdlib/posix_compat.rs

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

@youknowone
youknowone marked this pull request as ready for review November 3, 2026 04:17
@youknowone
youknowone enabled auto-merge (squash) November 3, 2026 04:17
@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-03T04:20:28.248586Z ae0c720 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.

@youknowone
youknowone merged commit b6d0ca4 into RustPython:main Nov 3, 2026
28 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