Skip to content

Fix resource index conversion and REPL warning - #8654

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowone:compiler-cpython-parity-followup
Sep 5, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowone:compiler-cpython-parity-followup

Conversation

@youknowone

@youknowone youknowone commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • accept objects implementing __index__ when converting resource.setrlimit() limits
  • only emit the PyREPL fallback warning when standard input is a terminal, keeping piped stdin clean

Testing

  • cargo fmt --all -- --check
  • cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher --exclude rustpython-capi
  • (cd crates/capi && cargo test)
  • cargo clippy --workspace --all-targets --exclude rustpython_wasm --exclude rustpython-venvlauncher --exclude rustpython-capi
  • (cd crates/capi && cargo clippy --all-targets)
  • target/release/rustpython -m test test_resource
  • target/release/rustpython -m test -m "*test_dumb_terminal_exits_cleanly*" test_pyrepl.test_pyrepl
  • manual __index__, negative limit, overflow, and piped-stdin checks

Summary by CodeRabbit

  • Bug Fixes
    • Resource limit values can now be provided by any object that supports integer conversion through __index__, rather than only by integer objects.
    • The unavailable interactive REPL warning is now shown only when standard input is connected to a terminal, preventing unnecessary warnings in non-interactive environments.

Accept __index__ values when converting resource limits and only report PyREPL fallback reasons for terminal-backed interactive sessions.

Assisted-by: Codex:gpt-5
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Team

Run ID: 262fe3ad-ae2f-4dd9-89aa-d10d0011e313

📥 Commits

Reviewing files that changed from the base of the PR and between 5346842 and ab04606.

📒 Files selected for processing (2)
  • crates/stdlib/src/resource.rs
  • src/lib.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change accepts __index__ objects for resource limits and limits PyREPL availability warnings to terminal input sessions.

Changes

Runtime Input Handling

Layer / File(s) Summary
Resource limit integer conversion
crates/stdlib/src/resource.rs
py2rlim_limit now uses try_index, so objects implementing __index__ are accepted.
Terminal warning guard
src/lib.rs
The PyREPL availability warning now runs only when standard input is a terminal.

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

Merge Risk: ⚪ Minimal · up to ab046

Resource limits now accept index-compatible values, and PyREPL availability warnings no longer pollute piped input. The supplied evidence indicates the intended validation and terminal behavior are preserved, with no remaining merge-blocking risk.

Suggested reviewers: shaharnaveh, bschoenmaeckers

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes both changes: resource index conversion and the REPL warning behavior.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@youknowone
youknowone merged commit c8cc54f into RustPython:main Sep 5, 2026
28 of 29 checks passed
@youknowone
youknowone deleted the compiler-cpython-parity-followup branch September 5, 2026 10:49
youknowone added a commit that referenced this pull request Sep 16, 2026
Accept __index__ values when converting resource limits and only report PyREPL fallback reasons for terminal-backed interactive sessions.

Assisted-by: Codex:gpt-5
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.

1 participant