This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, lys.nikolaou, pablogsal
Date 2022-01-19.23:07:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642633676.14.0.383568464091.issue46441@roundup.psfhosted.org>
In-reply-to
Content
This seems to happen in 3.11 in the REPL only.

>>> def f():
...   print(0)
...   return yield 42
  File "<stdin>", line 3
    def f():
            ^
SyntaxError: invalid syntax

Note that running it from a file gives the expected output:

PS C:\Users\gvanrossum\cpython> py -3.10 .\t.py
  File "C:\Users\gvanrossum\cpython\t.py", line 3
    return yield 42
           ^^^^^
SyntaxError: invalid syntax

as does the 3.10 REPL:

>>> def f():
...   print(0)
...   return yield 42
  File "<stdin>", line 3
    return yield 42
           ^^^^^
SyntaxError: invalid syntax
History
Date User Action Args
2022-01-19 23:07:56gvanrossumsetrecipients: + gvanrossum, lys.nikolaou, pablogsal
2022-01-19 23:07:56gvanrossumsetmessageid: <1642633676.14.0.383568464091.issue46441@roundup.psfhosted.org>
2022-01-19 23:07:56gvanrossumlinkissue46441 messages
2022-01-19 23:07:56gvanrossumcreate