Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context manager support to aifc module #60690

Closed
serhiy-storchaka opened this issue Nov 16, 2012 · 5 comments
Closed

Add context manager support to aifc module #60690

serhiy-storchaka opened this issue Nov 16, 2012 · 5 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 16486
Nosy @birkenfeld, @jcea, @bitdancer, @serhiy-storchaka
Dependencies
  • bpo-16485: FD leaks in aifc module
  • Files
  • aifc_context_manager.patch
  • 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']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 16, 2012
    @serhiy-storchaka serhiy-storchaka self-assigned this Dec 27, 2012
    @birkenfeld
    Copy link
    Member

    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
    Copy link
    Member Author

    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
    Copy link
    Mannequin

    python-dev mannequin commented 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
    Copy link
    Member Author

    I have added the test that the file was actually closed using external file (as in test_close()).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants