Skip to content

Commit 54a8c32

Browse files
committed
Close cached file handles on cache destruction
1 parent e4fd573 commit 54a8c32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ev3dev.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ class FileCache(object):
5656
def __init__(self):
5757
self._cache = {}
5858

59+
def __del__(self):
60+
for f in self._cache.values():
61+
f.close()
62+
5963
def file_handle( self, path, mode, reopen=False ):
6064
"""Manages the file handle cache and opening the files in the correct mode"""
6165

0 commit comments

Comments
 (0)