Skip to content

Add context manager support to aifc module #60690

Closed

Description

@serhiy-storchaka
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']

    Activity

    1. serhiy-storchaka commented on Nov 16, 2012

      @serhiy-storchaka
      MemberAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Nov 16, 2012
    3. birkenfeld commented on Dec 28, 2012

      @birkenfeld
      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.

    4. serhiy-storchaka commented on Dec 28, 2012

      @serhiy-storchaka
      MemberAuthor

      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.

    5. python-dev commented on Dec 29, 2012

      python-devmannequin
      Mannequin

      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

    6. serhiy-storchaka commented on Dec 29, 2012

      @serhiy-storchaka
      MemberAuthor

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

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions