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

Method enter

crates/vm/src/vm/interpreter.rs:354–359  ·  view source on GitHub ↗

Run a function with the main virtual machine and return a PyResult of the result. To enter vm context multiple times or to avoid buffer/exception management, this function is preferred. `enter` is lightweight and it returns a python object in PyResult. You can stop or continue the execution multiple times by calling `enter`. To finalize the vm once all desired `enter`s are called, calling `final

(&self, f: F)

Source from the content-addressed store, hash-verified

352 ///
353 /// See also [`Interpreter::run`] for managed way to run the interpreter.
354 pub fn enter<F, R>(&self, f: F) -> R
355 where
356 F: FnOnce(&VirtualMachine) -> R,
357 {
358 thread::enter_vm(&self.vm, || f(&self.vm))
359 }
360
361 /// Run [`Interpreter::enter`] and call [`VirtualMachine::expect_pyresult`] for the result.
362 ///

Callers 8

test_nested_frozenFunction · 0.45
frozen_origname_matchesFunction · 0.45
enter_and_expectMethod · 0.45
runMethod · 0.45
finalizeMethod · 0.45
test_add_py_integersFunction · 0.45
test_multiply_strFunction · 0.45

Calls 2

enter_vmFunction · 0.85
fFunction · 0.50

Tested by 5

test_nested_frozenFunction · 0.36
frozen_origname_matchesFunction · 0.36
test_add_py_integersFunction · 0.36
test_multiply_strFunction · 0.36