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

gh-91162: Support substitution of TypeVar with an unpacked variable-size tuple #93330

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented May 29, 2022

For example:

A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]

#91162

…able-size tuple

For example:

  A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
  A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]
@serhiy-storchaka serhiy-storchaka added type-feature A feature request or enhancement needs backport to 3.11 only security fixes labels May 29, 2022
@serhiy-storchaka serhiy-storchaka changed the title gh-91162: Support substitution of TypeVar with an unpacked variable-size tuple [WIP] gh-91162: Support substitution of TypeVar with an unpacked variable-size tuple May 29, 2022
@serhiy-storchaka serhiy-storchaka changed the title [WIP] gh-91162: Support substitution of TypeVar with an unpacked variable-size tuple gh-91162: Support substitution of TypeVar with an unpacked variable-size tuple May 29, 2022
@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review May 29, 2022 18:49
if (arg) {
if (vartuplearg < nitems) {
Py_DECREF(arg);
Py_DECREF(fillarg);
Copy link
Member

Choose a reason for hiding this comment

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

This could use an assert(fillarg) to make sure it's not NULL.

Copy link
Member Author

Choose a reason for hiding this comment

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

Py_DECREF() makes sure that the argument is not NULL. The result is the same -- a crash.

@serhiy-storchaka
Copy link
Member Author

See also #93412.

@serhiy-storchaka serhiy-storchaka deleted the typing-subst-unpacked-vat-tuple branch June 12, 2022 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge needs backport to 3.11 only security fixes type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants