ImportProGen: Prevent leaking file handle
svn: r21829
This commit is contained in:
parent
54c228882c
commit
2fe5255b11
@ -462,7 +462,9 @@ class PG30_Def:
|
|||||||
|
|
||||||
# This can throw a IOError
|
# This can throw a IOError
|
||||||
import io
|
import io
|
||||||
lines = io.open(fname, buffering=1, encoding='cp437', errors='strict').readlines()
|
lines = None
|
||||||
|
with f = io.open(fname, buffering=1, encoding='cp437', errors='strict'):
|
||||||
|
lines = f.readlines()
|
||||||
lines = [l.strip() for l in lines]
|
lines = [l.strip() for l in lines]
|
||||||
content = '\n'.join(lines).encode('utf-8')
|
content = '\n'.join(lines).encode('utf-8')
|
||||||
parts = re.split(r'\n(?=\[)', content)
|
parts = re.split(r'\n(?=\[)', content)
|
||||||
|
Loading…
Reference in New Issue
Block a user