You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree with @graingert in #164 that we should raise a resource warning just to be safe if RustNotify isn't explicitly "closed" even though it mostly wouldn't actually be necessary since __del__ would clean up the thread.
However at the moment it seems pyo3 doesn't support the __del__ method, see PyO3/pyo3#2479.
Once (if) pyo3 support __del__, here is the code to add so I don't need to remember it:
pubfn__del__(&mutself,py:Python) -> PyResult<()>{ifmatches!(self.watcher,WatcherEnum::None){Ok(())}else{self.close();let resource_warning = py.import("warnings")?.getattr("ResourceWarning")?;PyErr::warn(py, resource_warning,"RustNotify was not closed correctly",1)}}
The text was updated successfully, but these errors were encountered:
I agree with @graingert in #164 that we should raise a resource warning just to be safe if
RustNotify
isn't explicitly "closed" even though it mostly wouldn't actually be necessary since__del__
would clean up the thread.However at the moment it seems pyo3 doesn't support the
__del__
method, see PyO3/pyo3#2479.Once (if) pyo3 support
__del__
, here is the code to add so I don't need to remember it:The text was updated successfully, but these errors were encountered: