(&self, new_init: Option<PyRef<PyFunction>>, vm: Option<&VirtualMachine>)
| 301 | |
| 302 | #[inline] |
| 303 | fn swap_init(&self, new_init: Option<PyRef<PyFunction>>, vm: Option<&VirtualMachine>) { |
| 304 | if let Some(vm) = vm { |
| 305 | // Keep replaced refs alive for the currently executing frame, matching |
| 306 | // CPython-style "old pointer remains valid during ongoing execution" |
| 307 | // without accumulating global retired refs. |
| 308 | self.init.swap_to_temporary_refs(new_init, vm); |
| 309 | return; |
| 310 | } |
| 311 | // SAFETY: old value is moved to `retired`, so it stays alive while |
| 312 | // concurrent readers may still hold borrowed references. |
| 313 | let old = unsafe { self.init.swap(new_init) }; |
| 314 | self.retire_old_function(old); |
| 315 | } |
| 316 | |
| 317 | #[inline] |
| 318 | fn swap_getitem(&self, new_getitem: Option<PyRef<PyFunction>>, vm: Option<&VirtualMachine>) { |
no test coverage detected