Issue #18817: Fix a resource warning in Lib/aifc.py demo.

This commit is contained in:
Serhiy Storchaka 2013-08-25 19:12:56 +03:00
parent cd0f74b1e0
commit b33baf1c9f
2 changed files with 25 additions and 19 deletions

View File

@ -873,6 +873,7 @@ if __name__ == '__main__':
sys.argv.append('/usr/demos/data/audio/bach.aiff')
fn = sys.argv[1]
f = open(fn, 'r')
try:
print("Reading", fn)
print("nchannels =", f.getnchannels())
print("nframes =", f.getnframes())
@ -884,12 +885,15 @@ if __name__ == '__main__':
gn = sys.argv[2]
print("Writing", gn)
g = open(gn, 'w')
try:
g.setparams(f.getparams())
while 1:
data = f.readframes(1024)
if not data:
break
g.writeframes(data)
finally:
g.close()
f.close()
print("Done.")
finally:
f.close()

View File

@ -378,6 +378,8 @@ Documentation
Tools/Demos
-----------
- Issue #18817: Fix a resource warning in Lib/aifc.py demo.
- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS.
- Issue #18448: Fix a typo in Tools/demo/eiffel.py.