pywinusb
pywinusb copied to clipboard
Freeze when closing handle from __del__ during python exit
I tried to add a __del__
method for cleanup but it freezes if python exits while the object is alive.
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
pywinusb 0.4.2
import pywinusb.hid
class C:
def __init__(self,h):
self.h = h
def __del__(self):
print("closing")
self.h.close()
print("closed")
h = pywinusb.hid.HidDeviceFilter().get_devices()[0]
h.open()
c = C(h)
# del c # works if do this before python exits