Basic support for typing_extensions.NamedTuple#13178
Merged
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds basic support for
typing_extensions.NamedTuple, added to thetyping_extensionsruntime 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 thattyping_extensions.NamedTupleshould be treated much the same astyping.NamedTuplein nearly all circumstances.I haven't cherry-picked the typeshed change in this PR (which was cherry-picked to the
0.970branch in #13149, but doesn't exist onmasteryet). 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 fortyping_extensions.overload).