Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support my PEP 649 branch #412

Merged
merged 2 commits into from
May 27, 2024
Merged

Support my PEP 649 branch #412

merged 2 commits into from
May 27, 2024

Conversation

JelleZijlstra
Copy link
Member

Tests now pass with python/cpython#119361.

try:
__annotations__[1] = 2
except NameError:
pass # 3.14+
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add an assert system.version >= (3, 14) inside the except block?

Comment on lines +945 to +951
if "__annotations__" in ns:
own_annotations = ns["__annotations__"]
elif "__annotate__" in ns:
# TODO: Use inspect.VALUE here, and make the annotations lazily evaluated
own_annotations = ns["__annotate__"](1)
else:
own_annotations = {}
Copy link
Member

Choose a reason for hiding this comment

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

You mentioned in python/cpython#119361 (comment) that you'd be adding a helper function for this kind of thing at some point -- would it be worth waiting for that, since the first 3.14 alpha is some way off?

I can also see the advantages of getting typing_extensions working with your branch, though, so that you can start testing with the rest of the ecosystem that depends on typing_extensions. So I definitely don't want to block you merging this.

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 do expect we'll need more changes later, but it's helpful to get this merged so I can test the rest of the ecosystem too.

@JelleZijlstra JelleZijlstra merged commit 920d60d into python:main May 27, 2024
21 checks passed
@JelleZijlstra JelleZijlstra deleted the pep649 branch May 27, 2024 23:14
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.

3 participants