Skip to content

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstraJelleZijlstra commented Jul 21, 2024

A third alternative to #120719 and #120816. See python/peps#3847 (comment).

This PR is on top of #119891.


📚 Documentation preview 📚: https://cpython-previews--122074.org.readthedocs.build/

@JelleZijlstraJelleZijlstra marked this pull request as ready for review July 24, 2024 00:18
Copy link
Member

@carljmcarljm left a comment

Choose a reason for hiding this comment

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

Looks great!

Returns the __annotate__ function or None.
"""
ifisinstance(obj, type):
return_BASE_GET_ANNOTATE(obj)
Copy link
Member

Choose a reason for hiding this comment

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

It may be worth explaining, in a comment or docstring (here or somewhere) why we have to go to these odd lengths.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good point, will do that. Thanks for reviewing!

@JelleZijlstraJelleZijlstra enabled auto-merge (squash) July 27, 2024 16:13
@JelleZijlstraJelleZijlstra merged commit 45614ec into python:mainJul 27, 2024
@JelleZijlstraJelleZijlstra deleted the pep649-basedescriptor branch July 27, 2024 16:58
JelleZijlstra added a commit to JelleZijlstra/typing_extensions that referenced this pull request Jul 27, 2024
Tests from python/cpython#122074. We don't have to use the base descriptor approach here because we find the annotations directly in the `__dict__` for the class, which avoids metaclass problems.
JelleZijlstra added a commit to python/typing_extensions that referenced this pull request Sep 23, 2024
 Tests from python/cpython#122074. We don't have to use the base descriptor approach here because we find the annotations directly in the `__dict__` for the class, which avoids metaclass problems.
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.

2 participants

@JelleZijlstra@carljm