We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a029a5a commit 7d0b226Copy full SHA for 7d0b226
1 file changed
kaitaistruct.py
@@ -30,8 +30,13 @@ def close(self):
30
31
@classmethod
32
def from_file(cls, filename):
33
- with open(filename, 'rb') as f:
+ f = open(filename, 'rb')
34
+ try:
35
return cls(KaitaiStream(f))
36
+ except Exception:
37
+ # close file descriptor, then reraise the exception
38
+ f.close()
39
+ raise
40
41
42
def from_bytes(cls, buf):
0 commit comments