Add context manager support to aifc module #60690
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
| BPO | 16486 |
|---|---|
| Nosy | @birkenfeld, @jcea, @bitdancer, @serhiy-storchaka |
| Dependencies | |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = 'https://github.com/serhiy-storchaka'
closed_at = <Date 2012-12-29.21:00:45.340>
created_at = <Date 2012-11-16.13:39:23.691>
labels = ['type-feature', 'library']
title = 'Add context manager support to aifc module'
updated_at = <Date 2013-01-27.02:04:31.053>
user = 'https://github.com/serhiy-storchaka'bugs.python.org fields:
activity = <Date 2013-01-27.02:04:31.053>
actor = 'jcea'
assignee = 'serhiy.storchaka'
closed = True
closed_date = <Date 2012-12-29.21:00:45.340>
closer = 'serhiy.storchaka'
components = ['Library (Lib)']
creation = <Date 2012-11-16.13:39:23.691>
creator = 'serhiy.storchaka'
dependencies = ['16485']
files = ['28001']
hgrepos = []
issue_num = 16486
keywords = ['patch']
message_count = 5.0
messages = ['175687', '178368', '178391', '178535', '178536']
nosy_count = 5.0
nosy_names = ['georg.brandl', 'jcea', 'r.david.murray', 'python-dev', 'serhiy.storchaka']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue16486'
versions = ['Python 3.4']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Activity
serhiy-storchaka commentedon Nov 16, 2012
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 bpo-16485 to pass tests.
birkenfeld commentedon Dec 28, 2012
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.
serhiy-storchaka commentedon Dec 28, 2012
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.
python-dev commentedon Dec 29, 2012
New changeset 9beb11071dd1 by Serhiy Storchaka in branch 'default':
Issue bpo-16486: Make aifc files work with 'with' as context managers.
http://hg.python.org/cpython/rev/9beb11071dd1
serhiy-storchaka commentedon Dec 29, 2012
I have added the test that the file was actually closed using external file (as in test_close()).