Run a function in this thread context # Note If you return a `PyObjectRef` (or a type that contains one) from `F`, and don't return the object to the parent thread and then `join()` on the `JoinHandle` (or similar), there is a possibility that the current thread will panic as `PyObjectRef`'s `Drop` implementation tries to run the `__del__` destructor of a python object but finds that it's not in
(&self, f: F)
| 553 | /// the current thread will panic as `PyObjectRef`'s `Drop` implementation tries to run the `__del__` |
| 554 | /// destructor of a python object but finds that it's not in the context of any vm. |
| 555 | pub fn run<F, R>(&self, f: F) -> R |
| 556 | where |
| 557 | F: FnOnce(&VirtualMachine) -> R, |
| 558 | { |
| 559 | let vm = &self.vm; |
| 560 | enter_vm(vm, || f(vm)) |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | impl VirtualMachine { |
no test coverage detected