This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Got resource warning when running Lib/aifc.py
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: python-dev, serhiy.storchaka, vajrasky
Priority: low Keywords: patch

Created on 2013-08-23 05:13 by vajrasky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_resource_warning_aifc.patch vajrasky, 2013-08-23 05:13 review
Messages (3)
msg195943 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-08-23 05:13
The python is compiled with debug option.

<omitted>cpython$ ./python Lib/aifc.py Lib/test/sndhdrdata/sndhdr.aiff 
Reading Lib/test/sndhdrdata/sndhdr.aiff
nchannels = 2
nframes   = 5
sampwidth = 2
framerate = 44100
comptype  = b'NONE'
compname  = b'not compressed'
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='Lib/test/sndhdrdata/sndhdr.aiff'>

Attached the patch to close the file automatically and print "Done." message not just with writing mode but for reading mode as well.
msg196150 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-25 16:18
New changeset e3eec06aa12e by Serhiy Storchaka in branch '2.7':
Issue #18817: Fix a resource warning in Lib/aifc.py demo.
http://hg.python.org/cpython/rev/e3eec06aa12e

New changeset e0c33e0c0483 by Serhiy Storchaka in branch '3.3':
Issue #18817: Fix a resource warning in Lib/aifc.py demo.
http://hg.python.org/cpython/rev/e0c33e0c0483

New changeset 1da223c1b7ed by Serhiy Storchaka in branch 'default':
Issue #18817: Fix a resource warning in Lib/aifc.py demo.  Patch by
http://hg.python.org/cpython/rev/1da223c1b7ed
msg196151 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-25 16:24
Thank you for your patch Vajrasky.
History
Date User Action Args
2022-04-11 14:57:49adminsetgithub: 63017
2013-08-25 16:24:53serhiy.storchakasetstatus: open -> closed
versions: + Python 2.7, Python 3.3
messages: + msg196151

resolution: fixed
stage: patch review -> resolved
2013-08-25 16:18:25python-devsetnosy: + python-dev
messages: + msg196150
2013-08-23 19:14:28serhiy.storchakasetstage: patch review
2013-08-23 19:14:04serhiy.storchakasetpriority: normal -> low
assignee: serhiy.storchaka
2013-08-23 08:20:58pitrousetnosy: + serhiy.storchaka
2013-08-23 05:13:15vajraskycreate