Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -53,7 +53,7 @@ from typing import (
IO,
TYPE_CHECKING,
Any,
Optional,
ParamSpec,
TypeVar,
cast,
)
@ -78,7 +78,6 @@ from .._core._exceptions import (
EndOfStream,
RunFinishedError,
WouldBlock,
iterate_exceptions,
)
from .._core._sockets import convert_ipv6_sockaddr
from .._core._streams import create_memory_object_stream
@ -109,11 +108,6 @@ if TYPE_CHECKING:
else:
FileDescriptorLike = object
if sys.version_info >= (3, 10):
from typing import ParamSpec
else:
from typing_extensions import ParamSpec
if sys.version_info >= (3, 11):
from asyncio import Runner
from typing import TypeVarTuple, Unpack
@ -498,17 +492,39 @@ class CancelScope(BaseCancelScope):
self._pending_uncancellations -= 1
# Update cancelled_caught and check for exceptions we must not swallow
cannot_swallow_exc_val = False
if exc_val is not None:
for exc in iterate_exceptions(exc_val):
if isinstance(exc, CancelledError) and is_anyio_cancellation(
exc
):
self._cancelled_caught = True
else:
cannot_swallow_exc_val = True
if isinstance(exc_val, BaseExceptionGroup):
cancelleds_caught, remaining = exc_val.split(
lambda exc: (
isinstance(exc, CancelledError)
and is_anyio_cancellation(exc)
)
)
return self._cancelled_caught and not cannot_swallow_exc_val
if cancelleds_caught is None:
return False
self._cancelled_caught = True
if remaining is None:
return True
context = remaining.__context__
try:
# Preserve __cause__ and __suppress_context__ by avoiding `raise
# ... from ...`
raise remaining
finally:
# Preserve __context__
remaining.__context__ = context
del context
else:
if isinstance(exc_val, CancelledError) and is_anyio_cancellation(
exc_val
):
self._cancelled_caught = True
return True
else:
return False
else:
if self._pending_uncancellations:
assert self._parent_scope is not None
@ -928,7 +944,7 @@ class TaskGroup(abc.TaskGroup):
# Threads
#
_Retval_Queue_Type = tuple[Optional[T_Retval], Optional[BaseException]]
_Retval_Queue_Type = tuple[T_Retval | None, BaseException | None]
class WorkerThread(Thread):
@ -1139,7 +1155,7 @@ def _forcibly_shutdown_process_pool_on_exit(
# Close as much as possible (w/o async/await) to avoid warnings
for process in workers.copy():
if process.returncode is None:
if process.returncode is not None:
continue
process._stdin._stream._transport.close() # type: ignore[union-attr]
@ -1192,8 +1208,7 @@ class StreamProtocol(asyncio.Protocol):
def connection_lost(self, exc: Exception | None) -> None:
if exc:
self.exception = BrokenResourceError()
self.exception.__cause__ = exc
self.exception = exc
self.read_event.set()
self.write_event.set()
@ -1277,7 +1292,7 @@ class SocketStream(abc.SocketStream):
if self._closed:
raise ClosedResourceError from None
elif self._protocol.exception:
raise self._protocol.exception from None
raise BrokenResourceError from self._protocol.exception
else:
raise EndOfStream from None
@ -1300,7 +1315,7 @@ class SocketStream(abc.SocketStream):
if self._closed:
raise ClosedResourceError
elif self._protocol.exception is not None:
raise self._protocol.exception
raise BrokenResourceError from self._protocol.exception
try:
self._transport.write(item)
@ -2243,6 +2258,7 @@ class TestRunner(abc.TestRunner):
async def _call_in_runner_task(
self,
func: Callable[P, Awaitable[T_Retval]],
/,
*args: P.args,
**kwargs: P.kwargs,
) -> T_Retval: