X Tutup
Skip to content

Commit 758e4ea

Browse files
committed
call close() in __del__()
1 parent 18dd456 commit 758e4ea

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

doc/changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ Development
55
^^^^^^^^^^^
66

77
Enhancements:
8-
- Reworked documentation and docstrings.
8+
- Rework documentation and docstrings.
99

10+
Fixes:
11+
- Call ``InputDevice.close()`` in ``InputDevice.__del__()``.
1012

1113
0.4.1 (Jul 24, 2013)
1214
^^^^^^^^^^^^^^^^^^^^

evdev/device.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ def __init__(self, dev):
110110
#: The raw dictionary of device capabilities - see `:func:capabilities()`.
111111
self._rawcapabilities = _input.ioctl_capabilities(self.fd)
112112

113+
def __del__(self):
114+
if hasattr(self, 'fd') and self.fd != None:
115+
self.close()
116+
113117
def _capabilities(self, absinfo=True):
114118
res = {}
115119
for etype, ecodes in self._rawcapabilities.items():

0 commit comments

Comments
 (0)
X Tutup