Skip to content

Commit f7204c8

Browse files
whitslackrustyrussell
authored andcommitted
pyln-testing: don't leak file descriptor in GossipStore
Changelog-None
1 parent a62e9c5 commit f7204c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

contrib/pyln-testing/pyln/testing/gossip.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ def __init__(self, path: Path):
1616
self.path = path
1717
self.log = logging.getLogger("GossipStore")
1818

19+
def __del__(self):
20+
if self.fd is not None:
21+
self.fd.close()
22+
1923
def open(self):
24+
if self.fd is not None:
25+
self.fd.close()
2026
self.fd = self.path.open(mode="rb")
2127
self.version = ord(self.fd.read(1))
2228
if self.version < 3:

0 commit comments

Comments
 (0)