Skip to content

Commit 7d0b226

Browse files
committed
Reverting change that broken ~13 tests
1 parent a029a5a commit 7d0b226

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kaitaistruct.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ def close(self):
3030

3131
@classmethod
3232
def from_file(cls, filename):
33-
with open(filename, 'rb') as f:
33+
f = open(filename, 'rb')
34+
try:
3435
return cls(KaitaiStream(f))
36+
except Exception:
37+
# close file descriptor, then reraise the exception
38+
f.close()
39+
raise
3540

3641
@classmethod
3742
def from_bytes(cls, buf):

0 commit comments

Comments
 (0)