(zelf: &Py<Self>, vm: &VirtualMachine)
| 325 | |
| 326 | impl ContextVar { |
| 327 | fn delete(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<()> { |
| 328 | zelf.cached.store(None); |
| 329 | |
| 330 | let ctx = PyContext::current(vm); |
| 331 | |
| 332 | let mut vars = ctx.borrow_vars_mut(); |
| 333 | if vars.swap_remove(zelf).is_none() { |
| 334 | // TODO: |
| 335 | // PyErr_SetObject(PyExc_LookupError, (PyObject *)var); |
| 336 | let msg = zelf.as_object().repr(vm)?.as_wtf8().to_owned(); |
| 337 | return Err(vm.new_lookup_error(msg)); |
| 338 | } |
| 339 | |
| 340 | Ok(()) |
| 341 | } |
| 342 | |
| 343 | // contextvar_set in CPython |
| 344 | fn set_inner(zelf: &Py<Self>, value: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |
nothing calls this directly
no test coverage detected