| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…tations (pythonGH-158939) With string annotations, dataclasses looks up the first name of each annotation to detect ClassVar, InitVar and KW_ONLY. If that name was a lazy import that could not be resolved, the lookup raised and the class could not be created, while the same class works with non-string annotations. This resolves lazy imports the way annotationlib does: try to resolve them, and treat a failure like a missing name. (cherry picked from commit 0f1d4a7) Co-authored-by: Brittany Reynoso <breynoso@meta.com>
There was a problem hiding this comment.
@brittanyrey I'm thinking this can wait for 3.15.1, what do you think?
Sorry, something went wrong.
|
@JelleZijlstra that's my gut feeling. @pablogsal what do you think? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
With string annotations, dataclasses looks up the first name of each
annotation to detect ClassVar, InitVar and KW_ONLY. If that name was a
lazy import that could not be resolved, the lookup raised and the class
could not be created, while the same class works with non-string
annotations.
This resolves lazy imports the way annotationlib does: try to resolve
them, and treat a failure like a missing name.
(cherry picked from commit 0f1d4a7)
Co-authored-by: Brittany Reynoso breynoso@meta.com