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

Method weakref_list_ref

crates/vm/src/object/core.rs:403–413  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

401 /// WeakRefList is always immediately before PyInner (fixed WEAKREF_OFFSET).
402 #[inline(always)]
403 pub(super) fn weakref_list_ref(&self) -> Option<&WeakRefList> {
404 let (flags, _) = self.read_type_flags();
405 if !flags.has_feature(crate::types::PyTypeFlags::HAS_WEAKREF) {
406 return None;
407 }
408 let self_addr = (self as *const Self as *const u8).addr();
409 let ptr = core::ptr::with_exposed_provenance::<WeakRefList>(
410 self_addr.wrapping_sub(WEAKREF_OFFSET),
411 );
412 Some(unsafe { &*ptr })
413 }
414}
415
416impl<T: fmt::Debug> fmt::Debug for PyInner<T> {

Callers 2

drop_innerMethod · 0.80
weak_ref_listMethod · 0.80

Calls 4

read_type_flagsMethod · 0.80
has_featureMethod · 0.80
SomeClass · 0.50
addrMethod · 0.45

Tested by

no test coverage detected