Fix resource leaking
This commit is contained in:
parent
0ac27ad0e2
commit
e03a47d7f8
@ -98,7 +98,8 @@ class Block:
|
|||||||
|
|
||||||
filelocation = 'data/blocks/%s.dat' % self.getHash()
|
filelocation = 'data/blocks/%s.dat' % self.getHash()
|
||||||
|
|
||||||
blockdata = open(filelocation, 'rb').read().decode('utf-8')
|
with open(filelocation, 'rb') as f:
|
||||||
|
blockdata = f.read().decode('utf-8')
|
||||||
|
|
||||||
self.blockFile = filelocation
|
self.blockFile = filelocation
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user