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

Function _reset_caches

crates/vm/src/stdlib/_abc.rs:463–478  ·  view source on GitHub ↗
(cls: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

461 /// Internal ABC helper to reset both caches of a given class.
462 #[pyfunction]
463 fn _reset_caches(cls: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
464 let impl_data = get_impl(&cls, vm)?;
465
466 // Clone set refs and drop locks before calling into VM to avoid reentrancy
467 let cache = impl_data.cache.read().clone();
468 if let Some(ref set) = cache {
469 vm.call_method(set.as_ref(), "clear", ())?;
470 }
471
472 let negative_cache = impl_data.negative_cache.read().clone();
473 if let Some(ref set) = negative_cache {
474 vm.call_method(set.as_ref(), "clear", ())?;
475 }
476
477 Ok(())
478 }
479}

Callers 1

_abc_caches_clearMethod · 0.90

Calls 5

get_implFunction · 0.85
cloneMethod · 0.45
readMethod · 0.45
call_methodMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected