gc is vm/stdlib by youknowone · Pull Request #6929 · RustPython/RustPython
Caution
Review failed
The pull request is closed.
📝 Walkthrough
Walkthrough
Adds internal bz2 and compression modules to stdlib, removes gc from that stdlib declaration, registers a private gc module in crates/vm/src/stdlib, and narrows PyObject::gc_finalized visibility to crate-only; also updates import paths in the gc stdlib file.
Changes
| Cohort / File(s) | Summary |
|---|---|
Stdlib core modules crates/stdlib/src/lib.rs |
Adds mod bz2; and mod compression; (compression marked internal); removes previous gc declaration from this file and adds bz2::module_def(ctx) and compression::module_def(ctx) to stdlib_module_defs. |
VM stdlib registration crates/vm/src/stdlib/mod.rs |
Adds private mod gc; and registers gc::module_def(ctx) in builtin_module_defs. |
GC implementation changes crates/vm/src/stdlib/gc.rs |
Updates imports to use direct crate-root types (PyObjectRef, PyResult, VirtualMachine, builtins::PyListRef, function::{FuncArgs, OptionalArg}) and removes a comment in is_finalized (function now directly returns obj.gc_finalized()). |
API visibility crates/vm/src/object/core.rs |
Changes PyObject::gc_finalized visibility from pub fn to pub(crate) fn, restricting access to the crate. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- gc module internal structure and API #6910: Modifies VM gc integration and
gcstdlib registration—closely related to thegcmodule registration changes here. - impl gc finialized #6689: Adds/adjusts
gc_finalizedAPI and GC bit mechanics that intersect with the visibility change togc_finalized.
Suggested reviewers
- ShaharNaveh
Poem
🐰 I hopped through modules, tidy and spry,
Added bz2, compression — gave gc a new sky.
A quieter finale, visibility small,
The rabbit applauds changes, big and small. 🥕✨
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
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 and usage tips.