MCPcopy Index your code
hub / github.com/RustPython/RustPython / begin

Function begin

crates/vm/src/object/core.rs:106–125  ·  view source on GitHub ↗
(
        obj: *mut super::PyObject,
        dealloc: unsafe fn(*mut super::PyObject),
    )

Source from the content-addressed store, hash-verified

104 /// false if the object was deferred (depth exceeded).
105 #[inline]
106 pub(super) unsafe fn begin(
107 obj: *mut super::PyObject,
108 dealloc: unsafe fn(*mut super::PyObject),
109 ) -> bool {
110 DEALLOC_DEPTH.with(|d| {
111 let depth = d.get();
112 if depth >= TRASHCAN_LIMIT {
113 // Depth exceeded: defer this deallocation
114 DEALLOC_QUEUE.with(|q| {
115 let mut queue = q.take();
116 queue.push((obj, dealloc));
117 q.set(queue);
118 });
119 false
120 } else {
121 d.set(depth + 1);
122 true
123 }
124 })
125 }
126
127 /// End deallocation and process any deferred objects if at outermost level.
128 #[inline]

Callers 1

default_deallocFunction · 0.85

Calls 5

withMethod · 0.80
getMethod · 0.45
takeMethod · 0.45
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected