Skip to content

Warn for direct bool file descriptor arguments - #9555

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-fildes-bool-warning-20261103
Nov 3, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix-fildes-bool-warning-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Match CPython's PyObject_AsFileDescriptor warning for a direct bool argument in the shared Fildes converter. This is an eight-line Rust-only change in crates/vm/src/stdlib/_io.rs.

Emit RuntimeWarning("bool is used as a file descriptor") at stack level 1 before conversion. If warnings are errors, return before descriptor conversion or a host operation. Preserve the existing behavior for fileno() returning bool: it does not emit this warning. Integer/range checks, callback lookup and descriptor ownership are unchanged.

Reference: CPython 3.15.0 PyObject_AsFileDescriptor.

Validation

  • Independent source review, git diff --check, and normal commit hooks (rustfmt, cspell, merge-conflict check) passed.
  • Offline workspace/C-API tests, workspace/C-API Clippy, and the canonical test_select test_poll test_epoll test_fcntl test_termios invocation were attempted but blocked before compilation by the unavailable parking_lot_core git dependency. No local compilation or runtime pass is claimed.
  • Existing canonical tests cover general descriptor and fileno() paths, but do not establish direct-bool warnings, warning-as-error behavior, or absence of a warning for a bool returned by fileno(). These remain runtime coverage gaps.
  • No Lib, snippet, test, dependency, or workflow changes. No unsafe descriptor probes were run.

Draft pending exact-head CI. AI assistance: OpenAI Codex performed investigation, implementation and independent source review; model version was not exposed.

Match PyObject_AsFileDescriptor for direct bool arguments without warning on bool returned by fileno(). Propagate warning errors before descriptor conversion.

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

coderabbitai Bot commented Nov 3, 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 3, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix-fildes-bool-warning-20261103 (9f51aee) with main (016cdff)

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. ↩

@youknowone
youknowone marked this pull request as ready for review November 3, 2026 03:09
@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-03T03:12:03.583956Z 9f51aee 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 0a88bee into RustPython:main Nov 3, 2026
29 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