gh-119180: Make FORWARDREF format look at __annotations__ first by JelleZijlstra · Pull Request #124479 · python/cpython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Comment on lines +669 to +670
| # But if we didn't get it, we use __annotations__ instead. | ||
| ann = _get_dunder_annotations(obj) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? If we can't get stringified annotations, I would think we'd want to return an empty dict, not fall back to returning non-stringified annotations. (Unless maybe __future__.annotations is active, in which case __annotations__ will be stringified anyway.)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just posted #124551 which instead stringifies the annotations we find.