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

Fix asynchronous generators athrow() and aclose() to handle StopAsyncIteration #72907

Closed
1st1 opened this issue Nov 16, 2016 · 2 comments
Closed
Assignees
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-bug An unexpected behavior, bug, or error

Comments

@1st1
Copy link
Member

1st1 commented Nov 16, 2016

BPO 28721
Nosy @ned-deily, @1st1
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • agen.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/1st1'
    closed_at = <Date 2016-11-16.23:26:54.874>
    created_at = <Date 2016-11-16.23:12:03.626>
    labels = ['interpreter-core', 'type-bug', '3.7', 'release-blocker']
    title = 'Fix asynchronous generators athrow() and aclose() to handle StopAsyncIteration'
    updated_at = <Date 2017-03-31.16:36:18.956>
    user = 'https://github.com/1st1'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:18.956>
    actor = 'dstufft'
    assignee = 'yselivanov'
    closed = True
    closed_date = <Date 2016-11-16.23:26:54.874>
    closer = 'yselivanov'
    components = ['Interpreter Core']
    creation = <Date 2016-11-16.23:12:03.626>
    creator = 'yselivanov'
    dependencies = []
    files = ['45514']
    hgrepos = []
    issue_num = 28721
    keywords = ['patch']
    message_count = 2.0
    messages = ['281008', '281009']
    nosy_count = 3.0
    nosy_names = ['ned.deily', 'python-dev', 'yselivanov']
    pr_nums = ['552']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue28721'
    versions = ['Python 3.6', 'Python 3.7']

    @1st1
    Copy link
    Member Author

    1st1 commented Nov 16, 2016

    1. aclose() should not propagate StopAsyncIteration:
      async def agen():
         try:
            yield
         except: 
            pass
      gen = agen()
      await agen.asend(None)
      await agen.aclose()  # <- this shouldn't raise StopAsyncIteration
    1. athrow() should propagate StopAsyncIteration when the exception was swallowed by the generator and it returned:
      async def agen():
         try:
            yield
         except: 
            pass
      gen = agen()
      await agen.asend(None)
      await agen.athrow(ValueError)  # <- this should raise StopAsyncIteration

    @1st1 1st1 self-assigned this Nov 16, 2016
    @1st1 1st1 added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Nov 16, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 16, 2016

    New changeset 0f12a1d3a737 by Yury Selivanov in branch '3.6':
    Issue bpo-28721: Fix asynchronous generators aclose() and athrow()
    https://hg.python.org/cpython/rev/0f12a1d3a737

    New changeset 22cd78026ad1 by Yury Selivanov in branch 'default':
    Merge 3.6 (issue bpo-28721)
    https://hg.python.org/cpython/rev/22cd78026ad1

    @1st1 1st1 closed this as completed Nov 16, 2016
    @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
    3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant