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

Function is_module_initializing

crates/vm/src/frame.rs:9696–9707  ·  view source on GitHub ↗
(module: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

9694}
9695
9696fn is_module_initializing(module: &PyObject, vm: &VirtualMachine) -> bool {
9697 let Ok(spec) = module.get_attr(&vm.ctx.new_str("__spec__"), vm) else {
9698 return false;
9699 };
9700 if vm.is_none(&spec) {
9701 return false;
9702 }
9703 let Ok(initializing_attr) = spec.get_attr(&vm.ctx.new_str("_initializing"), vm) else {
9704 return false;
9705 };
9706 initializing_attr.try_to_bool(vm).unwrap_or(false)
9707}
9708
9709fn expect_unchecked<T: fmt::Debug>(optional: Option<T>, err_msg: &'static str) -> T {
9710 if cfg!(debug_assertions) {

Callers 1

import_fromMethod · 0.85

Calls 4

try_to_boolMethod · 0.80
get_attrMethod · 0.45
new_strMethod · 0.45
is_noneMethod · 0.45

Tested by

no test coverage detected