mirror of https://github.com/m-labs/artiq.git
bit2bin: close input file explicitly
This commit is contained in:
parent
65c835e991
commit
852ddb7796
|
@ -32,8 +32,7 @@ def flip32(data):
|
|||
|
||||
|
||||
def bit2bin(bit, bin, flip=False):
|
||||
bitfile = open(bit, "rb")
|
||||
|
||||
with open(bit, "rb") as bitfile:
|
||||
l, = struct.unpack(">H", bitfile.read(2))
|
||||
if l != 9:
|
||||
raise ValueError("Missing <0009> header, not a bit file")
|
||||
|
|
Loading…
Reference in New Issue