(cls: PyObjectRef, vm: &VirtualMachine)
| 461 | /// Internal ABC helper to reset both caches of a given class. |
| 462 | #[pyfunction] |
| 463 | fn _reset_caches(cls: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |
| 464 | let impl_data = get_impl(&cls, vm)?; |
| 465 | |
| 466 | // Clone set refs and drop locks before calling into VM to avoid reentrancy |
| 467 | let cache = impl_data.cache.read().clone(); |
| 468 | if let Some(ref set) = cache { |
| 469 | vm.call_method(set.as_ref(), "clear", ())?; |
| 470 | } |
| 471 | |
| 472 | let negative_cache = impl_data.negative_cache.read().clone(); |
| 473 | if let Some(ref set) = negative_cache { |
| 474 | vm.call_method(set.as_ref(), "clear", ())?; |
| 475 | } |
| 476 | |
| 477 | Ok(()) |
| 478 | } |
| 479 | } |
no test coverage detected