Repository navigation
Fix ctypes subclass bitfields and native type metadata - #9395
Conversation
Assisted-by: Codex:GPT-6
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. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Native conversion and pointer checks crates/vm/src/stdlib/_ctypes/function.rs, extra_tests/snippets/stdlib_ctypes.py |
Argument validation, pointer casting, return handling, and py_object result detection use stored type metadata. Tests check native-call conversion and pointer casting after _type_ changes. |
Bitfield subclass access crates/vm/src/stdlib/_ctypes/base.rs, extra_tests/snippets/stdlib_ctypes.py |
Bitfield extraction applies when the field returns a scalar. Tests check access to a MutableInt bitfield. A comment notes that c_bool writes the whole byte for bitfields; setter logic is unchanged. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related PRs
- RustPython/RustPython#9390: Changes ctypes scalar metadata, bitfield access, and native conversion; this PR addresses related scalar-subclass cases.
- RustPython/RustPython#9229: Introduces storage-backed ctypes views and initialized scalar metadata used by these changes.
- RustPython/RustPython#9251: Introduces initialized scalar codes and storage-backed scalar field handling extended here.
Suggested reviewers: youknowone
Merge Risk: 
Minimal · up to 2bb10
-
The reviewed changes have no established merge-blocking issue; they are ready for normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed -
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- 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.
Comment @coderabbitai help to get the list of available commands.
Follow-up to #9390, addressing issues found during its review.
Summary
.value._type_cannot change the native representation or pointer eligibility.AI assistance
Written with Codex (GPT-6), reviewed by a human before submission.
Summary by CodeRabbit
ctypeshandling when scalar and pointer subclasses change their type attributes, including native-call conversion, pointer casting, and bitfield access.