Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect error message for yield from #121657

Closed
@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

% ./python.exe -c 'yield x'
  File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'yield from x'
  File "<string>", line 1
SyntaxError: 'yield' outside function
% ./python.exe -c 'async def f(): yield from x'
  File "<string>", line 1
SyntaxError: 'yield from' inside async function

The middle one should also say "yield from".

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions