(vm: &VirtualMachine)
| 127 | } |
| 128 | |
| 129 | fn current(vm: &VirtualMachine) -> PyRef<Self> { |
| 130 | super::CONTEXTS.with_borrow_mut(|ctxs| { |
| 131 | if let Some(ctx) = ctxs.last() { |
| 132 | ctx.clone() |
| 133 | } else { |
| 134 | let ctx = Self::empty(vm); |
| 135 | ctx.inner.idx.set(0); |
| 136 | ctx.inner.entered.set(true); |
| 137 | let ctx = ctx.into_ref(&vm.ctx); |
| 138 | ctxs.push(ctx); |
| 139 | ctxs[0].clone() |
| 140 | } |
| 141 | }) |
| 142 | } |
| 143 | |
| 144 | fn contains(&self, needle: &Py<ContextVar>) -> PyResult<bool> { |
| 145 | let vars = self.borrow_vars(); |