pyln-testing: don't leak file descriptor in GossipStore
Changelog-None
This commit is contained in:
committed by
Rusty Russell
parent
a62e9c5573
commit
f7204c8dd7
@@ -16,7 +16,13 @@ class GossipStore(object):
|
||||
self.path = path
|
||||
self.log = logging.getLogger("GossipStore")
|
||||
|
||||
def __del__(self):
|
||||
if self.fd is not None:
|
||||
self.fd.close()
|
||||
|
||||
def open(self):
|
||||
if self.fd is not None:
|
||||
self.fd.close()
|
||||
self.fd = self.path.open(mode="rb")
|
||||
self.version = ord(self.fd.read(1))
|
||||
if self.version < 3:
|
||||
|
||||
Reference in New Issue
Block a user