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

Method setup_annotations

crates/vm/src/frame.rs:7108–7121  ·  view source on GitHub ↗
(&mut self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

7106
7107 #[cold]
7108 fn setup_annotations(&mut self, vm: &VirtualMachine) -> FrameResult {
7109 let __annotations__ = identifier!(vm, __annotations__);
7110 let locals_obj = self.locals.as_object(vm);
7111 // Try using locals as dict first, if not, fallback to generic method.
7112 let has_annotations = if let Some(d) = locals_obj.downcast_ref_if_exact::<PyDict>(vm) {
7113 d.contains_key(__annotations__, vm)
7114 } else {
7115 self._in(vm, __annotations__.as_object(), locals_obj)?
7116 };
7117 if !has_annotations {
7118 locals_obj.set_item(__annotations__, vm.ctx.new_dict().into(), vm)?;
7119 }
7120 Ok(None)
7121 }
7122
7123 /// _PyEval_UnpackIterableStackRef
7124 fn unpack_sequence(&mut self, size: u32, vm: &VirtualMachine) -> FrameResult {

Callers 1

execute_instructionMethod · 0.80

Calls 5

contains_keyMethod · 0.80
_inMethod · 0.80
new_dictMethod · 0.80
as_objectMethod · 0.45
set_itemMethod · 0.45

Tested by

no test coverage detected