Skip to content

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commented May 4, 2025

Closes#82129. Closes#122262.

This is on top of @sobolevn's #122262 but jumps through a few more hoops to achieve these goals:

  • The annotations on dataclasses with make_dataclass() are sensible in all formats
  • We don't import typing until we really have to

try:
ann=_get_dunder_annotations(obj)
exceptNameError:
exceptException:
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a separate PR (with tests) for this change in #133407.

Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviving this PR! It looks like it achieves its main goal.

@JelleZijlstraJelleZijlstra marked this pull request as ready for review May 4, 2025 22:59
Copy link
Member

@sobolevnsobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JelleZijlstraJelleZijlstra merged commit bb5ec6e into python:mainMay 5, 2025
45 checks passed
@JelleZijlstraJelleZijlstra deleted the gh18219-alt branch May 5, 2025 15:21
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Carl Meyer <carl@oddbird.net>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_type_hints fails if there are un-annotated fields in a dataclass

2 participants

@JelleZijlstra@sobolevn