typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

uWSGI: Use a `TypeVarTuple` in `uwsgidecorators.thread`

Open Daverball opened this issue 2 years ago • 7 comments

This addresses one of the FIXME comments (and a stubtest_allowlist entry) in types-uWSGI


Deferral reason: https://github.com/google/pytype/issues/1525

Daverball avatar Dec 09 '23 16:12 Daverball

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

github-actions[bot] avatar Dec 09 '23 16:12 github-actions[bot]

Looks like pytype isn't happy with the use of a TypeVarTuple in a generic class yet.

Daverball avatar Dec 09 '23 16:12 Daverball

Is there a pytype issue we can refer to that tracks the necessary support?

JelleZijlstra avatar Feb 17 '24 16:02 JelleZijlstra

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

github-actions[bot] avatar Feb 17 '24 16:02 github-actions[bot]

Is there a pytype issue we can refer to that tracks the necessary support?

The issue is that pytype doesn't yet support classes being generic over Unpack[Ts]. I don't think pytype has a more specific issue for that than https://github.com/google/pytype/issues/1525.

When we use Unpack[Ts] for a parameter annotation, pytype just falls back to Any, but it doesn't yet do that if a class is generic over Unpack[Ts]. I can think of reasons why that might be a little harder to do, but I don't know that it actually is harder.

AlexWaygood avatar Feb 17 '24 16:02 AlexWaygood

The reason it's harder is that the generic now needs to be able to accept multiple values instead of just one, as well as some of the other special rules, such as not requiring redundant brackets. So I can see why there is maybe no easy way to add partial support for it, except for maybe the most simple case, where a generic accepts a single TypeVarTuple and nothing else, re-using the tuple logic 1:1.

Daverball avatar Feb 17 '24 16:02 Daverball