Typechecking with Fields in 3.10 #381
Unanswered
Atticus1806
asked this question in
Q&A
Replies: 1 comment
-
You could resolve the type references to actual types before handing them over to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
4.0.0
Python version
3.10
What happened?
For our work we want to implement type-checked dataclasses. We currently did this via this code:
This does not work with python 3.10 since
field.type
returns a string. Sometimestypeguard
catches this and "ignores" the type with a warning, sometimes it crashes. Currently we have a hacky solution to this problem but want to ask if there is some cleaner way to solve it:This works in our setup and produces (at least for our tests) correct behavior. Is there something similar known? Is there a better workaround?
How can we reproduce the bug?
See above.
Beta Was this translation helpful? Give feedback.
All reactions