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

Basic support for typing_extensions.NamedTuple #13178

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Jul 18, 2022

Description

This PR adds basic support for typing_extensions.NamedTuple, added to the typing_extensions runtime in python/typing_extensions@7c28357 and added to the typeshed stub in python/typeshed@10f3238.

This PR doesn't add support for generic NamedTuples: that'll have to come later. For now, it just teaches mypy that typing_extensions.NamedTuple should be treated much the same as typing.NamedTuple in nearly all circumstances.

I haven't cherry-picked the typeshed change in this PR (which was cherry-picked to the 0.970 branch in #13149, but doesn't exist on master yet). It turned out I didn't need to do the cherry-pick in order for the tests to pass. I'm happy to do the cherry-pick as part of this PR if it's desirable, but I assume this PR comes too late to make it into release 0.970, and I assume there'll be another typeshed sync before release 0.980 comes out.

Test Plan

I added a test making sure that all the basics work as expected, but didn't try to duplicate all tests relating to typing.NamedTuple (a similar approach to the one taken in #12602 for typing_extensions.overload).

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@hauntsaninja hauntsaninja merged commit fbbcc50 into python:master Jul 19, 2022
@AlexWaygood AlexWaygood deleted the ext-namedtuple branch July 19, 2022 07:00
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