You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP-563 (Postponed evaluation of annotations) breaks loading attr classes #80
It appears that when you have attr classes that are in a file with from __future__ import annotations, cattrs does not work when trying to structure a simple type to your attrs class. This is because attrs uses __annotations__ to get the type annotations and with PEP-563, these are now strings instead of the actual type, see python-attrs/attrs#288 (comment) for a description
This little script below demonstrates the problem. If you comment out the first line, the from __future__ import annotations, it works, but if you put it back, you get a ValueError because the type that cattr passed to functools.singledispatch is a string of the type, not the type itself.
changed the title [-]PEP-563 / posponed evaluation of annotations breaks loading attr classes[/-][+]PEP-563 (Postponed evaluation of annotations) breaks loading attr classes[/+]on Dec 13, 2019
Activity
[-]PEP-563 / posponed evaluation of annotations breaks loading attr classes[/-][+]PEP-563 (Postponed evaluation of annotations) breaks loading attr classes[/+]ex-nerd commentedon Jan 21, 2020
Seems this is the same as #41 and submitted as PR #42. Edit: actually, looks like there are a couple PRs dealing with this issue.
Tinche commentedon Mar 21, 2021
Fixed!