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

Function with_current_vm

crates/vm/src/vm/thread.rs:71–76  ·  view source on GitHub ↗
(f: impl FnOnce(&VirtualMachine) -> R)

Source from the content-addressed store, hash-verified

69scoped_tls::scoped_thread_local!(static VM_CURRENT: VirtualMachine);
70
71pub fn with_current_vm<R>(f: impl FnOnce(&VirtualMachine) -> R) -> R {
72 if !VM_CURRENT.is_set() {
73 panic!("call with_current_vm() but VM_CURRENT is null");
74 }
75 VM_CURRENT.with(f)
76}
77
78pub fn enter_vm<R>(vm: &VirtualMachine, f: impl FnOnce() -> R) -> R {
79 VM_STACK.with(|vms| {

Callers 1

thunk_callbackFunction · 0.85

Calls 2

withMethod · 0.80
is_setMethod · 0.45

Tested by

no test coverage detected