Skip to content

Commit

Permalink
Explicitly make T_Retval covariant
Browse files Browse the repository at this point in the history
  • Loading branch information
gschaffner committed Jun 30, 2023
1 parent f7d3f5f commit 43e3e26
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/anyio/_backends/_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _do_shutdown(future: asyncio.futures.Future) -> None:
thread.join()


T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
T_contra = TypeVar("T_contra", contravariant=True)
PosArgsT = TypeVarTuple("PosArgsT")
P = ParamSpec("P")
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/_backends/_trio.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from typing_extensions import TypeVarTuple, Unpack

T = TypeVar("T")
T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
T_SockAddr = TypeVar("T_SockAddr", str, IPSockAddrType)
PosArgsT = TypeVarTuple("PosArgsT")

Expand Down
2 changes: 1 addition & 1 deletion src/anyio/_core/_eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# This must be updated when new backends are introduced
BACKENDS = "asyncio", "trio"

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
PosArgsT = TypeVarTuple("PosArgsT")

threadlocals = threading.local()
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/abc/_eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from ._tasks import TaskGroup
from ._testing import TestRunner

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)


class AsyncBackend(metaclass=ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/abc/_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SockAddrType = Union[IPSockAddrType, str]
UDPPacketType = Tuple[bytes, IPSockAddrType]
UNIXDatagramPacketType = Tuple[bytes, str]
T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)


class _NullAsyncContextManager:
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/abc/_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if TYPE_CHECKING:
from .._core._tasks import CancelScope

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
T_contra = TypeVar("T_contra", contravariant=True)
PosArgsT = TypeVarTuple("PosArgsT")

Expand Down
2 changes: 1 addition & 1 deletion src/anyio/from_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
else:
from typing_extensions import TypeVarTuple, Unpack

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
T_co = TypeVar("T_co", covariant=True)
PosArgsT = TypeVarTuple("PosArgsT")

Expand Down
2 changes: 1 addition & 1 deletion src/anyio/streams/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .._core._typedattr import TypedAttributeSet, typed_attribute
from ..abc import AnyByteStream, ByteStream, Listener, TaskGroup

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
_PCTRTT = Tuple[Tuple[str, str], ...]
_PCTRTTT = Tuple[_PCTRTT, ...]

Expand Down
2 changes: 1 addition & 1 deletion src/anyio/to_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

WORKER_MAX_IDLE_TIME = 300 # 5 minutes

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
PosArgsT = TypeVarTuple("PosArgsT")

_process_pool_workers: RunVar[set[Process]] = RunVar("_process_pool_workers")
Expand Down
2 changes: 1 addition & 1 deletion src/anyio/to_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
else:
from typing_extensions import TypeVarTuple, Unpack

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)
PosArgsT = TypeVarTuple("PosArgsT")


Expand Down
2 changes: 1 addition & 1 deletion tests/test_from_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

pytestmark = pytest.mark.anyio

T_Retval = TypeVar("T_Retval")
T_Retval = TypeVar("T_Retval", covariant=True)


async def async_add(a: int, b: int) -> int:
Expand Down

0 comments on commit 43e3e26

Please sign in to comment.