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

Function _get_dump

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

Source from the content-addressed store, hash-verified

407 /// Internal ABC helper for cache and registry debugging.
408 #[pyfunction]
409 fn _get_dump(cls: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyTupleRef> {
410 let impl_data = get_impl(&cls, vm)?;
411
412 let registry = {
413 let r = impl_data.registry.read();
414 match &*r {
415 Some(s) => {
416 // Use copy method to get a shallow copy
417 vm.call_method(s.as_ref(), "copy", ())?
418 }
419 None => PySet::default().to_pyobject(vm),
420 }
421 };
422
423 let cache = {
424 let c = impl_data.cache.read();
425 match &*c {
426 Some(s) => vm.call_method(s.as_ref(), "copy", ())?,
427 None => PySet::default().to_pyobject(vm),
428 }
429 };
430
431 let negative_cache = {
432 let nc = impl_data.negative_cache.read();
433 match &*nc {
434 Some(s) => vm.call_method(s.as_ref(), "copy", ())?,
435 None => PySet::default().to_pyobject(vm),
436 }
437 };
438
439 let version = impl_data.get_cache_version();
440
441 Ok(vm.ctx.new_tuple(vec![
442 registry,
443 cache,
444 negative_cache,
445 vm.ctx.new_int(version).into(),
446 ]))
447 }
448
449 /// Internal ABC helper to reset registry of a given class.
450 #[pyfunction]

Callers 2

_dump_registryMethod · 0.90
runtest_refleakFunction · 0.90

Calls 7

get_implFunction · 0.85
get_cache_versionMethod · 0.80
readMethod · 0.45
call_methodMethod · 0.45
as_refMethod · 0.45
to_pyobjectMethod · 0.45
new_tupleMethod · 0.45

Tested by

no test coverage detected