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

Method copy

crates/stdlib/src/contextvars.rs:171–183  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

169
170 #[pymethod]
171 fn copy(&self, vm: &VirtualMachine) -> Self {
172 // Deep copy the vars - clone the underlying Hamt data, not just the PyRef
173 let vars_copy = HamtObject {
174 hamt: RefCell::new(self.inner.vars.hamt.borrow().clone()),
175 };
176 Self {
177 inner: ContextInner {
178 idx: Cell::new(usize::MAX),
179 vars: vars_copy.into_ref(&vm.ctx),
180 entered: Cell::new(false),
181 },
182 }
183 }
184
185 fn __getitem__(
186 &self,

Callers 1

copy_contextFunction · 0.45

Calls 4

newFunction · 0.85
cloneMethod · 0.45
borrowMethod · 0.45
into_refMethod · 0.45

Tested by

no test coverage detected