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

async for statement is not a syntax error in sync context #77544

Closed
zsol opened this issue Apr 26, 2018 · 6 comments
Closed

async for statement is not a syntax error in sync context #77544

zsol opened this issue Apr 26, 2018 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker type-bug An unexpected behavior, bug, or error

Comments

@zsol
Copy link
Contributor

zsol commented Apr 26, 2018

BPO 33363
Nosy @ned-deily, @njsmith, @1st1, @zsol
PRs
  • bpo-33363: raise SyntaxError for async for/with outside async functions #6616
  • [3.7] bpo-33363: raise SyntaxError for async for/with outside async functions (GH-6616). #6619
  • 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 = None
    closed_at = <Date 2018-04-27.22:34:03.590>
    created_at = <Date 2018-04-26.05:18:50.185>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7', 'release-blocker']
    title = 'async for statement is not a syntax error in sync context'
    updated_at = <Date 2018-04-27.22:34:03.589>
    user = 'https://github.com/zsol'

    bugs.python.org fields:

    activity = <Date 2018-04-27.22:34:03.589>
    actor = 'yselivanov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-04-27.22:34:03.590>
    closer = 'yselivanov'
    components = ['Interpreter Core']
    creation = <Date 2018-04-26.05:18:50.185>
    creator = 'zsol'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33363
    keywords = ['patch']
    message_count = 6.0
    messages = ['315775', '315776', '315777', '315847', '315859', '315860']
    nosy_count = 4.0
    nosy_names = ['ned.deily', 'njs', 'yselivanov', 'zsol']
    pr_nums = ['6616', '6619']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33363'
    versions = ['Python 3.7', 'Python 3.8']

    @zsol
    Copy link
    Contributor Author

    zsol commented Apr 26, 2018

    Since 3.7, async generators can be used in non-async functions. The way this is implemented allows the following to be valid syntax:

    def f():
        async for i in aiterable:
            pass
        return 1

    The return value of the above function is a Future that will never be done().

    @zsol zsol added 3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Apr 26, 2018
    @1st1
    Copy link
    Member

    1st1 commented Apr 26, 2018

    Wow, this is a regression that has to be fixed in 3.7.

    @njsmith
    Copy link
    Contributor

    njsmith commented Apr 26, 2018

    Sorry, not sure why bpo decided to reset the priority there.

    @1st1
    Copy link
    Member

    1st1 commented Apr 27, 2018

    New changeset e239650 by Yury Selivanov (Zsolt Dollenstein) in branch 'master':
    bpo-33363: raise SyntaxError for async for/with outside async functions (bpo-6616)
    e239650

    @1st1
    Copy link
    Member

    1st1 commented Apr 27, 2018

    New changeset a93a663 by Yury Selivanov (Zsolt Dollenstein) in branch '3.7':
    [3.7] bpo-33363: raise SyntaxError for async for/with outside async functions (GH-6616). (GH-6619)
    a93a663

    @1st1
    Copy link
    Member

    1st1 commented Apr 27, 2018

    Thanks so much!

    @1st1 1st1 closed this as completed Apr 27, 2018
    @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 3.8 only security fixes 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

    3 participants