Skip to content

Commit 393689d

Browse files
authored
Merge PyInner into Py (#8820)
Rename the object layout struct `PyInner<T>` to `Py<T>` and make it the public type, replacing the `#[repr(transparent)]` newtype `Py<T>(PyInner<T>)`. Header fields stay `pub(super)`. `PyObject` now wraps `Py<Erased>`. - Drop the `.0` hop on `Py<T>` accesses. - Remove the delegating `Traverse for Py<T>` impl; the former `Traverse for PyInner<T>` impl now serves `Py<T>`. - Remove `Debug for PyInner<T>`; `debug_obj` writes the `[PyObject ...]` form itself. - Use `Py::from_payload_ptr` in `PyWeak::drop_inner` and drop its now-stale `allow(dead_code)`. Assisted-by: Claude Code:claude-opus-5-5
1 parent 98d6f23 commit 393689d

6 files changed

Lines changed: 96 additions & 119 deletions

File tree

‎crates/vm/src/builtins/tuple.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ unsafe impl Traverse for PyTuple {
101101
}
102102

103103
thread_local! {
104-
// A single freelist for all tuple sizes: `PyInner<PyTuple>` is a
104+
// A single freelist for all tuple sizes: `Py<PyTuple>` is a
105105
// fixed-size allocation (elements are a separate boxed slice that is
106106
// dropped and replaced on reuse), so husks are interchangeable.
107107
// freelist_push must not read the payload — it runs after tp_clear,

‎crates/vm/src/frame.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ fn cleared_frame_access() -> ! {
15901590
thread_local! {
15911591
/// Free list of dead frame objects for reuse. Entries are cleared husks
15921592
/// (`iframe == None`) whose child references were already released.
1593-
/// PyInner<FrameObject> is fixed-size (localsplus storage is out-of-line),
1593+
/// Py<FrameObject> is fixed-size (localsplus storage is out-of-line),
15941594
/// so a single bucket suffices.
15951595
static FRAME_FREELIST: core::cell::Cell<crate::object::FreeList<FrameObject>> =
15961596
const { core::cell::Cell::new(crate::object::FreeList::new()) };

‎crates/vm/src/gc_state.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl GcState {
408408
///
409409
/// Like [`Self::track_object`], but for the hot allocation path only:
410410
/// `obj`'s `gc_bits` must still hold its freshly-initialized value of `0`
411-
/// (true right after `PyInner::new` or a freelist pop, both of which zero
411+
/// (true right after `Py::new` or a freelist pop, both of which zero
412412
/// it), so the tracked bit can go in with a plain store instead of the
413413
/// `fetch_or` `set_gc_tracked()` needs to be safe for the general case
414414
/// (e.g. re-tracking a resurrected object, whose bits are not zero — it

0 commit comments

Comments
 (0)