mirror of https://github.com/python/cpython
Issue #18817: Fix a resource warning in Lib/aifc.py demo.
This commit is contained in:
parent
cd0f74b1e0
commit
b33baf1c9f
|
@ -873,6 +873,7 @@ 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')
|
||||||
|
try:
|
||||||
print("Reading", fn)
|
print("Reading", fn)
|
||||||
print("nchannels =", f.getnchannels())
|
print("nchannels =", f.getnchannels())
|
||||||
print("nframes =", f.getnframes())
|
print("nframes =", f.getnframes())
|
||||||
|
@ -884,12 +885,15 @@ if __name__ == '__main__':
|
||||||
gn = sys.argv[2]
|
gn = sys.argv[2]
|
||||||
print("Writing", gn)
|
print("Writing", gn)
|
||||||
g = open(gn, 'w')
|
g = open(gn, 'w')
|
||||||
|
try:
|
||||||
g.setparams(f.getparams())
|
g.setparams(f.getparams())
|
||||||
while 1:
|
while 1:
|
||||||
data = f.readframes(1024)
|
data = f.readframes(1024)
|
||||||
if not data:
|
if not data:
|
||||||
break
|
break
|
||||||
g.writeframes(data)
|
g.writeframes(data)
|
||||||
|
finally:
|
||||||
g.close()
|
g.close()
|
||||||
f.close()
|
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
|
@ -378,6 +378,8 @@ Documentation
|
||||||
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 Tools/demo/eiffel.py.
|
- Issue #18448: Fix a typo in Tools/demo/eiffel.py.
|
||||||
|
|
Loading…
Reference in New Issue