Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-82129: Improve annotations for make_dataclass()#133406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JelleZijlstra merged 14 commits intopython:mainfromJelleZijlstra:gh18219-alt
May 5, 2025

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commentedMay 4, 2025
edited by bedevere-appbot
Loading

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 withmake_dataclass() are sensible in all formats
  • We don't import typing until we really have to

@@ -868,7 +868,7 @@ def get_annotations(
# For FORWARDREF, we use __annotations__ if it exists
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 reviewMay 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 commitbb5ec6e intopython:mainMay 5, 2025
45 checks passed
@JelleZijlstraJelleZijlstra deleted the gh18219-alt branchMay 5, 2025 15:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sobolevnsobolevnsobolevn approved these changes

@ericvsmithericvsmithAwaiting requested review from ericvsmithericvsmith is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
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

[8]ページ先頭

©2009-2025 Movatter.jp