pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/133406

ps://github.githubassets.com/assets/actions-109fb3a41bacb1c2.css" /> gh-82129: Improve annotations for make_dataclass() by JelleZijlstra · Pull Request #133406 · python/cpython · GitHub
Skip to content

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

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

gh-82129: Improve annotations for make_dataclass()#133406
JelleZijlstra merged 14 commits intopython:mainfrom
JelleZijlstra:gh18219-alt

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra 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)
except NameError:
except Exception:
Copy link
Member Author

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

@sobolevn sobolevn 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.

@JelleZijlstra JelleZijlstra marked this pull request as ready for review May 4, 2025 22:59
@JelleZijlstra JelleZijlstra requested a review from ericvsmith as a code owner May 4, 2025 22:59
@JelleZijlstra JelleZijlstra requested a review from sobolevn May 4, 2025 23:26
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

LGTM

@JelleZijlstra JelleZijlstra merged commit bb5ec6e into python:main May 5, 2025
45 checks passed
@JelleZijlstra JelleZijlstra 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 free to 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

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy