classification
Title: Add context manager support to aifc module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: 16485 Superseder:
Assigned To: serhiy.storchaka Nosy List: georg.brandl, jcea, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-11-16 13:39 by serhiy.storchaka, last changed 2013-01-27 02:04 by jcea. This issue is now closed.

Files
File name Uploaded Description Edit
aifc_context_manager.patch serhiy.storchaka, 2012-11-16 13:39 review
Messages (5)
msg175687 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-11-16 13:39
The proposed patch adds context manager support aifc module.  Now objects returned by aifc.open() will support context manager protocol.

This issue required first fixing issue16485 to pass tests.
msg178368 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-12-28 07:23
The "self.fout.close()" is not needed here I think.

Another thing the test should test is that the file was actually closed on exception.

Otherwise, LGTM.
msg178391 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-28 16:45
fout.close() here is intentional no-op. This is a check that fout was closed properly (in contrary case close() should raise exception). Unfortunately there is no other way to test that fout was closed.
msg178535 - (view) Author: Roundup Robot (python-dev) Date: 2012-12-29 20:55
New changeset 9beb11071dd1 by Serhiy Storchaka in branch 'default':
Issue #16486: Make aifc files work with 'with' as context managers.
http://hg.python.org/cpython/rev/9beb11071dd1
msg178536 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-29 21:00
I have added the test that the file was actually closed using external file (as in test_close()).
History
Date User Action Args
2013-01-27 02:04:31jceasetnosy: + jcea
2012-12-29 21:00:45serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg178536

stage: patch review -> resolved
2012-12-29 20:55:59python-devsetnosy: + python-dev
messages: + msg178535
2012-12-28 16:45:37serhiy.storchakasetmessages: + msg178391
2012-12-28 07:23:13georg.brandlsetnosy: + georg.brandl
messages: + msg178368
2012-12-27 20:47:43serhiy.storchakasetassignee: serhiy.storchaka
2012-11-16 13:41:15serhiy.storchakasetnosy: + r.david.murray
dependencies: + FD leaks in aifc module

stage: patch review
2012-11-16 13:39:23serhiy.storchakacreate