Kaydet (Commit) 879a2137 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

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

üst 42831fef
...@@ -953,23 +953,27 @@ if __name__ == '__main__': ...@@ -953,23 +953,27 @@ if __name__ == '__main__':
sys.argv.append('/usr/demos/data/audio/bach.aiff') sys.argv.append('/usr/demos/data/audio/bach.aiff')
fn = sys.argv[1] fn = sys.argv[1]
f = open(fn, 'r') f = open(fn, 'r')
print "Reading", fn try:
print "nchannels =", f.getnchannels() print "Reading", fn
print "nframes =", f.getnframes() print "nchannels =", f.getnchannels()
print "sampwidth =", f.getsampwidth() print "nframes =", f.getnframes()
print "framerate =", f.getframerate() print "sampwidth =", f.getsampwidth()
print "comptype =", f.getcomptype() print "framerate =", f.getframerate()
print "compname =", f.getcompname() print "comptype =", f.getcomptype()
if sys.argv[2:]: print "compname =", f.getcompname()
gn = sys.argv[2] if sys.argv[2:]:
print "Writing", gn gn = sys.argv[2]
g = open(gn, 'w') print "Writing", gn
g.setparams(f.getparams()) g = open(gn, 'w')
while 1: try:
data = f.readframes(1024) g.setparams(f.getparams())
if not data: while 1:
break data = f.readframes(1024)
g.writeframes(data) if not data:
g.close() break
g.writeframes(data)
finally:
g.close()
print "Done."
finally:
f.close() f.close()
print "Done."
...@@ -141,6 +141,8 @@ Library ...@@ -141,6 +141,8 @@ Library
Tools/Demos Tools/Demos
----------- -----------
- Issue #18817: Fix a resource warning in Lib/aifc.py demo.
- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. - Issue #18439: Make patchcheck work on Windows for ACKS, NEWS.
- Issue #18448: Fix a typo in Demo/newmetaclasses/Eiffel.py. - Issue #18448: Fix a typo in Demo/newmetaclasses/Eiffel.py.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment