diff options
| author | robot-piglet <[email protected]> | 2026-03-02 19:10:53 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2026-03-02 21:23:20 +0300 |
| commit | 32a2ac46fd174a4d0957d671ad2cdf9db8ff468b (patch) | |
| tree | 66d0f150200eda9dc7637a0987f4d2e065197515 /contrib/python | |
| parent | 6157e6352dfff19f6277b78c69174ac7c2e23414 (diff) | |
Intermediate changes
commit_hash:95eb8b0bf95f8bca7022185ad6e23a27393a3c90
Diffstat (limited to 'contrib/python')
| -rw-r--r-- | contrib/python/trio/.dist-info/METADATA | 2 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_core/__init__.py | 6 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_core/_generated_run.py | 4 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_core/_run.py | 11 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_core/_thread_cache.py | 4 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_core/_traps.py | 4 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_deprecate.py | 3 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_highlevel_open_tcp_stream.py | 2 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_tools/gen_exports.py | 3 | ||||
| -rw-r--r-- | contrib/python/trio/trio/_version.py | 2 | ||||
| -rw-r--r-- | contrib/python/trio/trio/socket.py | 6 | ||||
| -rw-r--r-- | contrib/python/trio/trio/testing/__init__.py | 21 | ||||
| -rw-r--r-- | contrib/python/trio/ya.make | 2 |
13 files changed, 52 insertions, 18 deletions
diff --git a/contrib/python/trio/.dist-info/METADATA b/contrib/python/trio/.dist-info/METADATA index fd35de04c56..2a42da8b9b2 100644 --- a/contrib/python/trio/.dist-info/METADATA +++ b/contrib/python/trio/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: trio -Version: 0.32.0 +Version: 0.33.0 Summary: A friendly Python library for async concurrency and I/O Author-email: "Nathaniel J. Smith" <[email protected]> License-Expression: MIT OR Apache-2.0 diff --git a/contrib/python/trio/trio/_core/__init__.py b/contrib/python/trio/trio/_core/__init__.py index f9d8068f0cc..c53d9d59a08 100644 --- a/contrib/python/trio/trio/_core/__init__.py +++ b/contrib/python/trio/trio/_core/__init__.py @@ -86,9 +86,9 @@ if sys.platform == "win32" or ( write_overlapped, ) # Kqueue imports -if (sys.platform != "linux" and sys.platform != "win32") or ( - not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules -): +if ( + sys.platform != "linux" and sys.platform != "win32" and sys.platform != "android" +) or (not _t.TYPE_CHECKING and "sphinx.ext.autodoc" in sys.modules): from ._run import current_kqueue, monitor_kevent, wait_kevent del sys # It would be better to import sys as _sys, but mypy does not understand it diff --git a/contrib/python/trio/trio/_core/_generated_run.py b/contrib/python/trio/trio/_core/_generated_run.py index db1454e6c76..4da520109b0 100644 --- a/contrib/python/trio/trio/_core/_generated_run.py +++ b/contrib/python/trio/trio/_core/_generated_run.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: import contextvars from collections.abc import Awaitable, Callable - from outcome import Outcome + import outcome from typing_extensions import Unpack from .._abc import Clock @@ -102,7 +102,7 @@ def current_root_task() -> Task | None: @enable_ki_protection -def reschedule(task: Task, next_send: Outcome[object] = _NO_SEND) -> None: +def reschedule(task: Task, next_send: outcome.Outcome[object] = _NO_SEND) -> None: """Reschedule the given task with the given :class:`outcome.Outcome`. diff --git a/contrib/python/trio/trio/_core/_run.py b/contrib/python/trio/trio/_core/_run.py index 4689dca104c..9ecdada1e09 100644 --- a/contrib/python/trio/trio/_core/_run.py +++ b/contrib/python/trio/trio/_core/_run.py @@ -25,6 +25,7 @@ from typing import ( ) import attrs +import outcome from outcome import Error, Outcome, Value, capture from sniffio import thread_local as sniffio_library from sortedcontainers import SortedDict @@ -1903,7 +1904,9 @@ class Runner: # type: ignore[explicit-any] ################ @_public - def reschedule(self, task: Task, next_send: Outcome[object] = _NO_SEND) -> None: + def reschedule( + self, task: Task, next_send: outcome.Outcome[object] = _NO_SEND + ) -> None: """Reschedule the given task with the given :class:`outcome.Outcome`. @@ -3113,7 +3116,11 @@ if sys.platform == "win32": WindowsIOManager as TheIOManager, _WindowsStatistics as IOStatistics, ) -elif sys.platform == "linux" or (not TYPE_CHECKING and hasattr(select, "epoll")): +elif ( + sys.platform == "linux" + or sys.platform == "android" + or (not TYPE_CHECKING and hasattr(select, "epoll")) +): from ._generated_io_epoll import * from ._io_epoll import ( EpollIOManager as TheIOManager, diff --git a/contrib/python/trio/trio/_core/_thread_cache.py b/contrib/python/trio/trio/_core/_thread_cache.py index 44820e7711f..c2b2315bd38 100644 --- a/contrib/python/trio/trio/_core/_thread_cache.py +++ b/contrib/python/trio/trio/_core/_thread_cache.py @@ -303,7 +303,9 @@ def start_thread_soon( THREAD_CACHE.start_thread_soon(fn, deliver, name) -def clear_worker_threads() -> None: +def clear_worker_threads() -> ( + None +): # pragma: no cover # see test_clear_thread_cache_after_fork # This is OK because the child process does not actually have any # worker threads. Additionally, while WorkerThread keeps a strong # reference and so would get affected, the only place those are diff --git a/contrib/python/trio/trio/_core/_traps.py b/contrib/python/trio/trio/_core/_traps.py index 652cc0b8793..14f66af927c 100644 --- a/contrib/python/trio/trio/_core/_traps.py +++ b/contrib/python/trio/trio/_core/_traps.py @@ -66,7 +66,9 @@ MessageType: TypeAlias = ( def _real_async_yield( obj: MessageType, ) -> Generator[MessageType, None, None]: - return (yield obj) + # "Using `yield` and `return {value}` in a generator function can + # lead to confusing behavior" + return (yield obj) # noqa: B901 # Real yield value is from trio's main loop, but type checkers can't diff --git a/contrib/python/trio/trio/_deprecate.py b/contrib/python/trio/trio/_deprecate.py index 5c827b4fda1..2f1f9f43a44 100644 --- a/contrib/python/trio/trio/_deprecate.py +++ b/contrib/python/trio/trio/_deprecate.py @@ -7,6 +7,8 @@ from typing import TYPE_CHECKING, ClassVar, TypeVar import attrs +from ._util import final + if TYPE_CHECKING: from collections.abc import Callable @@ -139,6 +141,7 @@ def deprecated_alias( return wrapper +@final @attrs.frozen(slots=False) class DeprecatedAttribute: _not_set: ClassVar[object] = object() diff --git a/contrib/python/trio/trio/_highlevel_open_tcp_stream.py b/contrib/python/trio/trio/_highlevel_open_tcp_stream.py index 1787f4a97e9..33f1e860258 100644 --- a/contrib/python/trio/trio/_highlevel_open_tcp_stream.py +++ b/contrib/python/trio/trio/_highlevel_open_tcp_stream.py @@ -162,7 +162,7 @@ def format_host_port(host: str | bytes, port: int | str) -> str: return f"{host}:{port}" -# Twisted's HostnameEndpoint has a good set of configurables: +# Twisted's HostnameEndpoint has a good set of configurations: # https://twistedmatrix.com/documents/current/api/twisted.internet.endpoints.HostnameEndpoint.html # # - per-connection timeout diff --git a/contrib/python/trio/trio/_tools/gen_exports.py b/contrib/python/trio/trio/_tools/gen_exports.py index e3d1659c02e..d1b5deb8442 100644 --- a/contrib/python/trio/trio/_tools/gen_exports.py +++ b/contrib/python/trio/trio/_tools/gen_exports.py @@ -3,6 +3,7 @@ Code generation script for class methods to be exported as public API """ + from __future__ import annotations import argparse @@ -347,7 +348,7 @@ IMPORTS_RUN = """\ from collections.abc import Awaitable, Callable from typing import Any, TYPE_CHECKING -from outcome import Outcome +import outcome import contextvars from ._run import _NO_SEND, RunStatistics, Task diff --git a/contrib/python/trio/trio/_version.py b/contrib/python/trio/trio/_version.py index 9f941c270b2..7a1cad22bd1 100644 --- a/contrib/python/trio/trio/_version.py +++ b/contrib/python/trio/trio/_version.py @@ -1,3 +1,3 @@ # This file is imported from __init__.py and parsed by setuptools -__version__ = "0.32.0" +__version__ = "0.33.0" diff --git a/contrib/python/trio/trio/socket.py b/contrib/python/trio/trio/socket.py index cfcb9943c83..5375a1a675a 100644 --- a/contrib/python/trio/trio/socket.py +++ b/contrib/python/trio/trio/socket.py @@ -26,9 +26,9 @@ if sys.platform == "win32": # have: globals().update( { - _name: getattr(_stdlib_socket, _name) - for _name in _stdlib_socket.__all__ - if _name.isupper() and _name not in _bad_symbols + name: getattr(_stdlib_socket, name) + for name in _stdlib_socket.__all__ + if name.isupper() and name not in _bad_symbols }, ) diff --git a/contrib/python/trio/trio/testing/__init__.py b/contrib/python/trio/trio/testing/__init__.py index d93d33aab7d..a8f323447e8 100644 --- a/contrib/python/trio/trio/testing/__init__.py +++ b/contrib/python/trio/trio/testing/__init__.py @@ -1,5 +1,6 @@ # Uses `from x import y as y` for compatibility with `pyright --verifytypes` (#2625) +from .. import _deprecate as _deprecate from .._core import ( MockClock as MockClock, wait_all_tasks_blocked as wait_all_tasks_blocked, @@ -28,12 +29,30 @@ from ._memory_streams import ( memory_stream_pump as memory_stream_pump, ) from ._network import open_stream_to_socket_listener as open_stream_to_socket_listener -from ._raises_group import Matcher as Matcher, RaisesGroup as RaisesGroup +from ._raises_group import Matcher as _Matcher, RaisesGroup as _RaisesGroup from ._sequencer import Sequencer as Sequencer from ._trio_test import trio_test as trio_test ################################################################ +_deprecate.deprecate_attributes( + __name__, + { + "RaisesGroup": _deprecate.DeprecatedAttribute( + _RaisesGroup, + version="0.33.0", + issue=3326, + instead="See https://docs.pytest.org/en/stable/reference/reference.html#pytest.RaisesGroup", + ), + "Matcher": _deprecate.DeprecatedAttribute( + _Matcher, + version="0.33.0", + issue=3326, + instead="See https://docs.pytest.org/en/stable/reference/reference.html#pytest.RaisesExc", + ), + }, +) + fixup_module_metadata(__name__, globals()) del fixup_module_metadata diff --git a/contrib/python/trio/ya.make b/contrib/python/trio/ya.make index a475b1ba818..31b8541ac2c 100644 --- a/contrib/python/trio/ya.make +++ b/contrib/python/trio/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.32.0) +VERSION(0.33.0) LICENSE(Apache-2.0 AND BSD-3-Clause AND LicenseRef-scancode-unknown-license-reference AND MIT AND "MIT OR Apache-2.0") |
