Repository navigation
Warn for direct bool file descriptor arguments - #9555
Conversation
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
|
Caution Review failedThe pull request is closed.
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. CodeRabbit Verify
|
Merging this PR will not alter performance
Comparing Footnotes
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Match CPython's
PyObject_AsFileDescriptorwarning for a direct bool argument in the sharedFildesconverter. This is an eight-line Rust-only change incrates/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 forfileno()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
git diff --check, and normal commit hooks (rustfmt, cspell, merge-conflict check) passed.test_select test_poll test_epoll test_fcntl test_termiosinvocation were attempted but blocked before compilation by the unavailableparking_lot_coregit dependency. No local compilation or runtime pass is claimed.fileno()paths, but do not establish direct-bool warnings, warning-as-error behavior, or absence of a warning for a bool returned byfileno(). These remain runtime coverage gaps.Draft pending exact-head CI. AI assistance: OpenAI Codex performed investigation, implementation and independent source review; model version was not exposed.