[uWSGI] Use a TypeVarTuple in uwsgidecorators.thread (#11128)

This commit is contained in:
David Salvisberg
2026-03-30 13:59:35 +02:00
committed by GitHub
parent 9023424987
commit ccf9411fb1
2 changed files with 6 additions and 15 deletions
@@ -5,10 +5,3 @@
uwsgidecorators.erlang
# This should really only be internal API, so we don't export it
uwsgidecorators.harakiri.real_call
# Error: is inconsistent
# ======================
# This is a limitation of ParamSpec, we can't specify that the
# the ParamSpec does have no keyword arguments, but we need the
# ParamSpec to properly annotate this decorator
uwsgidecorators.thread.__call__
+6 -8
View File
@@ -1,11 +1,12 @@
from collections.abc import Callable
from typing import Any, Generic, Literal, TypeVar, overload
from typing_extensions import ParamSpec
from typing_extensions import ParamSpec, TypeVarTuple, Unpack
from uwsgi import _RPCCallable
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
_Ts = TypeVarTuple("_Ts")
_SR = TypeVar("_SR", bound=Literal[0, -1, -2] | None)
_SignalCallbackT = TypeVar("_SignalCallbackT", bound=Callable[[int], Any])
_RPCCallableT = TypeVar("_RPCCallableT", bound=_RPCCallable)
@@ -166,13 +167,10 @@ class lock(Generic[_P, _T]):
def __init__(self, f: Callable[_P, _T]) -> None: ...
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
# FIXME: Technically this only allows positional arguments, but there is not really
# an adequate way yet to express this, once bound on ParamSpec does something
# we could probably enforce this
class thread(Generic[_P, _T]):
f: Callable[_P, _T]
def __init__(self, f: Callable[_P, _T]) -> None: ...
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ...
class thread(Generic[Unpack[_Ts], _T]):
f: Callable[[Unpack[_Ts]], _T]
def __init__(self, f: Callable[[Unpack[_Ts]], _T]) -> None: ...
def __call__(self, *args: Unpack[_Ts]) -> Callable[[Unpack[_Ts]], _T]: ...
class harakiri:
s: int