Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review: PyBoundMethod clear=false, update FreeList doc comment
- Set clear=false on PyBoundMethod (tp_clear=NULL in classobject.c)
- Update FreeList doc comment to match actual Drop behavior (raw dealloc)
  • Loading branch information
youknowone committed Mar 4, 2026
commit 7b614aef3c2e101f0e032c8153e2abb806a89e25
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ impl Constructor for PyFunction {
}
}

#[pyclass(module = false, name = "method", traverse)]
#[pyclass(module = false, name = "method", traverse, clear = false)]
#[derive(Debug)]
pub struct PyBoundMethod {
object: PyObjectRef,
Expand Down
8 changes: 4 additions & 4 deletions crates/vm/src/object/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,11 @@ impl<T: PyPayload + core::fmt::Debug> PyInner<T> {
}
}

/// Thread-local freelist storage that properly deallocates cached objects
/// on thread teardown.
/// Thread-local freelist storage for reusing object allocations.
///
/// Wraps a `Vec<*mut PyObject>` and implements `Drop` to convert each
/// raw pointer back into `Box<PyInner<T>>` for proper deallocation.
/// Wraps a `Vec<*mut PyObject>`. On thread teardown, `Drop` frees raw
/// `PyInner<T>` allocations without running payload destructors to avoid
/// accessing already-destroyed thread-local storage (GC state, other freelists).
pub(crate) struct FreeList<T: PyPayload> {
items: Vec<*mut PyObject>,
_marker: core::marker::PhantomData<T>,
Expand Down