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 find it a bit wonky that closing the watch can only be done through the destructor. Maybe it isn't the end of the world, but this sorta locks it to cPython.
The text was updated successfully, but these errors were encountered:
Most things of this nature do their resource management through __enter__ and __exit__ (so that it works with with) rather than relying on refcounting and the immediate object destruction and __del__ call. Since only cPython has the immediate destruction behavior, this would cause severe resource leaks on other implementations of Python that do not use refcounting for object lifetime.
Even on cPython, you can create a resource leak by keeping a reference to the watch in an object cycle, making it only get closed if and when the garbage collector runs.
It's true that this isn't really an issue for most use cases, but it's not particularly responsible IMO to depend on destructors for resource cleanup. That's a C++ thing.
I find it a bit wonky that closing the watch can only be done through the destructor. Maybe it isn't the end of the world, but this sorta locks it to cPython.
The text was updated successfully, but these errors were encountered: