Issue #18644: Fix a ResourceWarning in formatter.test().
Patch by Vajrasky Kok.
This commit is contained in:
parent
b461000a3f
commit
d91082c777
|
@ -436,11 +436,15 @@ def test(file = None):
|
||||||
fp = open(sys.argv[1])
|
fp = open(sys.argv[1])
|
||||||
else:
|
else:
|
||||||
fp = sys.stdin
|
fp = sys.stdin
|
||||||
for line in fp:
|
try:
|
||||||
if line == '\n':
|
for line in fp:
|
||||||
f.end_paragraph(1)
|
if line == '\n':
|
||||||
else:
|
f.end_paragraph(1)
|
||||||
f.add_flowing_data(line)
|
else:
|
||||||
|
f.add_flowing_data(line)
|
||||||
|
finally:
|
||||||
|
if fp is not sys.stdin:
|
||||||
|
fp.close()
|
||||||
f.end_paragraph(0)
|
f.end_paragraph(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue