Author BTaskaya
Recipients BTaskaya, gvanrossum, lys.nikolaou
Date 2020-12-23.21:09:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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/", 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/", line 1490, in get_type_hints
    value = ForwardRef(value)
  File "/usr/local/lib/python3.10/", 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)'
Date User Action Args
2020-12-23 21:09:33BTaskayasetrecipients: + BTaskaya, gvanrossum, lys.nikolaou
2020-12-23 21:09:33BTaskayasetmessageid: <>
2020-12-23 21:09:33BTaskayalinkissue42725 messages
2020-12-23 21:09:33BTaskayacreate