Guido van Rossum <gu...@python.org> added the comment:

To clarify, for Eric: what Batuhan did is effectively adding `from __future__ 
import annotations` to the top of dataclasses.py.

I believe the root cause is that dataclasses creates functions by synthesizing 
`def` statements (in _create_fn()) and the annotations there are references to 
variables in a dedicated namespace. Maybe we should patch the __annotations__ 
attribute of the result before sticking it into the class?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40794>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to