Skip to content

Commit f4df593

Browse files
committed
Clarify ctypes snapshot allocation helper names
Assisted-by: Codex:GPT-6
1 parent 332101a commit f4df593

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎crates/vm/src/gc_state.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ pub fn current_owner() -> GcOwner {
13761376
/// obj must be a valid pointer to an untracked PyObject with freshly zeroed `gc_bits`.
13771377
#[inline]
13781378
pub(crate) unsafe fn track_new_object(obj: NonNull<PyObject>) {
1379-
unsafe { track_new_object_with_collection(obj, true) };
1379+
unsafe { track_new_object_impl(obj, true) };
13801380
}
13811381

13821382
/// Track fresh internal storage, optionally allowing collection before its
@@ -1385,7 +1385,7 @@ pub(crate) unsafe fn track_new_object(obj: NonNull<PyObject>) {
13851385
/// # Safety
13861386
/// obj must be a valid pointer to an untracked PyObject with freshly zeroed `gc_bits`.
13871387
#[inline]
1388-
pub(crate) unsafe fn track_new_object_with_collection(obj: NonNull<PyObject>, collect: bool) {
1388+
pub(crate) unsafe fn track_new_object_impl(obj: NonNull<PyObject>, allow_collection: bool) {
13891389
let state = gc_state();
13901390
let Some(gc) = crate::vm::thread::current_gc_state() else {
13911391
// No interpreter is running: the shared context builds its own objects
@@ -1396,7 +1396,7 @@ pub(crate) unsafe fn track_new_object_with_collection(obj: NonNull<PyObject>, co
13961396
// SAFETY: as in `current_owner`.
13971397
let gc = unsafe { gc.as_ref() };
13981398
unsafe { state.track_object_fresh(obj, gc.owner) };
1399-
if collect {
1399+
if allow_collection {
14001400
state.maybe_collect(gc);
14011401
}
14021402
}

‎crates/vm/src/object/core.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2946,7 +2946,7 @@ impl<T: PyPayload> PyRef<T> {
29462946
impl<T: PyPayload + crate::object::MaybeTraverse + core::fmt::Debug> PyRef<T> {
29472947
#[inline(always)]
29482948
pub fn new_ref(payload: T, typ: crate::builtins::PyTypeRef, dict: Option<PyDictRef>) -> Self {
2949-
Self::new_ref_with_collection(payload, typ, dict, true)
2949+
Self::new_ref_impl(payload, typ, dict, true)
29502950
}
29512951

29522952
/// Allocate and track internal storage without running collection during
@@ -2966,15 +2966,15 @@ impl<T: PyPayload + crate::object::MaybeTraverse + core::fmt::Debug> PyRef<T> {
29662966
typ: crate::builtins::PyTypeRef,
29672967
dict: Option<PyDictRef>,
29682968
) -> Self {
2969-
Self::new_ref_with_collection(payload, typ, dict, false)
2969+
Self::new_ref_impl(payload, typ, dict, false)
29702970
}
29712971

29722972
#[inline(always)]
2973-
fn new_ref_with_collection(
2973+
fn new_ref_impl(
29742974
payload: T,
29752975
typ: crate::builtins::PyTypeRef,
29762976
dict: Option<PyDictRef>,
2977-
collect: bool,
2977+
allow_collection: bool,
29782978
) -> Self {
29792979
let has_dict = dict.is_some();
29802980
let is_heaptype = typ.heaptype_ext.is_some();
@@ -3021,7 +3021,7 @@ impl<T: PyPayload + crate::object::MaybeTraverse + core::fmt::Debug> PyRef<T> {
30213021
// Tracks under the interpreter running now and, when allowed,
30223022
// collects if this allocation pushed gen0 past its threshold.
30233023
unsafe {
3024-
crate::gc_state::track_new_object_with_collection(ptr.cast(), collect);
3024+
crate::gc_state::track_new_object_impl(ptr.cast(), allow_collection);
30253025
}
30263026
}
30273027

0 commit comments

Comments
 (0)