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 BTaskaya
Recipients BTaskaya, gvanrossum, lys.nikolaou
Date 2020-12-23.21:09:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1608757773.44.0.263946779087.issue42725@roundup.psfhosted.org>
In-reply-to
Content
> So I don't feel as strongly about that.

Just to note, since I believe the solution for all this might be the same (not processing annotations at all, since they will be compiled to strings in the later stage). If we go down on that route, it will be simpler but we won't be able to raise SyntaxError's for "a: (yield)" / "b: (await/yield from x)". 

By the way, this is what happens if you try to use get_type_hints on a function where an argument is (yield):

>>> typing.get_type_hints(a)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/typing.py", line 537, in __init__
    code = compile(arg, '<string>', 'eval')
  File "<string>", line 1
SyntaxError: 'yield' outside function

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/typing.py", line 1490, in get_type_hints
    value = ForwardRef(value)
  File "/usr/local/lib/python3.10/typing.py", line 539, in __init__
    raise SyntaxError(f"Forward reference must be an expression -- got {arg!r}")
SyntaxError: Forward reference must be an expression -- got '(yield)'
History
Date User Action Args
2020-12-23 21:09:33BTaskayasetrecipients: + BTaskaya, gvanrossum, lys.nikolaou
2020-12-23 21:09:33BTaskayasetmessageid: <1608757773.44.0.263946779087.issue42725@roundup.psfhosted.org>
2020-12-23 21:09:33BTaskayalinkissue42725 messages
2020-12-23 21:09:33BTaskayacreate