◐ Shell
clean mode source ↗

bpo-43224: Implement PEP 646 changes to genericaliasobject.c by mrahtz · Pull Request #31019 · python/cpython

These are the parts of the old PR (#30398) relevant to starring tuples. This allows us to do things like *args: *tuple[int, *Ts] (where Ts is a TypeVarTuple).

@gvanrossum Pradeep and I were wondering what the best way of representing a starred tuple would be, given that we'll also need a representation of a starred typing.Tuple for backport purposes. Should we try and make both *tuple[int] and *Tuple[int] refer to the same thing (I guess something we'd add to typing.py), or is it ok to have them refer to different things (as this PR currently assumes, creating a new native type for *tuple)?

Until the PR with the grammar changes has been merged (#31018), the tests for this look a little awkward. Happy to wait until that PR has been merged to be 100% sure this is correct.

@Fidget-Spinner Would you be happy to review this?

(Also, could someone add the 'skip news' label? The news item is being added in the grammar PR.) Jelle suggests creating a separate news item for each PR, so I've added an item for this one.

https://bugs.python.org/issue43224