From 3ea88dbeeeb89ee535cb7965f1dceead7c4702de Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 01:25:19 +0000 Subject: [PATCH 1/7] Dependency updates --- docs-requirements.txt | 8 ++++---- test-requirements.txt | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index 8274c1ec5..dbd3ff69a 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -2,7 +2,7 @@ # uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt alabaster==1.0.0 # via sphinx -attrs==25.4.0 +attrs==26.1.0 # via # -r docs-requirements.in # outcome @@ -24,7 +24,7 @@ colorama==0.4.6 ; sys_platform == 'win32' # via # click # sphinx -cryptography==46.0.5 +cryptography==46.0.6 # via pyopenssl docutils==0.22.4 # via @@ -53,11 +53,11 @@ packaging==26.0 # via sphinx pycparser==3.0 ; (implementation_name != 'PyPy' and os_name == 'nt') or (implementation_name != 'PyPy' and platform_python_implementation != 'PyPy') # via cffi -pygments==2.19.2 +pygments==2.20.0 # via sphinx pyopenssl==26.0.0 # via -r docs-requirements.in -requests==2.32.5 +requests==2.33.1 # via sphinx roman-numerals==4.1.0 # via sphinx diff --git a/test-requirements.txt b/test-requirements.txt index 2c1e2f880..89dde8663 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -8,7 +8,7 @@ astroid==4.0.4 # via pylint async-generator==1.10 # via -r test-requirements.in -attrs==25.4.0 +attrs==26.1.0 # via # -r test-requirements.in # outcome @@ -38,7 +38,7 @@ colorama==0.4.6 ; sys_platform == 'win32' # sphinx coverage==7.13.5 # via -r test-requirements.in -cryptography==46.0.5 +cryptography==46.0.6 # via # -r test-requirements.in # pyopenssl @@ -83,7 +83,7 @@ markupsafe==3.0.3 # via jinja2 mccabe==0.7.0 # via pylint -mypy==1.19.1 ; implementation_name == 'cpython' +mypy==1.20.0 ; implementation_name == 'cpython' # via -r test-requirements.in mypy-extensions==1.1.0 # via @@ -119,7 +119,7 @@ pre-commit==4.5.1 # via -r test-requirements.in pycparser==3.0 ; (implementation_name != 'PyPy' and os_name == 'nt') or (implementation_name != 'PyPy' and platform_python_implementation != 'PyPy') # via cffi -pygments==2.19.2 +pygments==2.20.0 # via # pytest # sphinx @@ -131,13 +131,13 @@ pyright==1.1.408 # via -r test-requirements.in pytest==9.0.2 # via -r test-requirements.in -python-discovery==1.2.0 +python-discovery==1.2.1 # via virtualenv pytokens==0.4.1 ; implementation_name == 'cpython' # via black pyyaml==6.0.3 # via pre-commit -requests==2.32.5 +requests==2.33.1 # via sphinx roman-numerals==4.1.0 ; python_full_version >= '3.11' # via sphinx @@ -167,7 +167,7 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -tomli==2.4.0 ; python_full_version < '3.11' +tomli==2.4.1 ; python_full_version < '3.11' # via # black # mypy @@ -182,7 +182,7 @@ types-cffi==2.0.0.20260316 # via # -r test-requirements.in # types-pyopenssl -types-docutils==0.22.3.20260316 +types-docutils==0.22.3.20260322 # via -r test-requirements.in types-pyopenssl==24.1.0.20240722 # via -r test-requirements.in From eea6d992a36095a2e94847c84ca0eaf4452fd077 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Mon, 6 Apr 2026 04:00:37 -0400 Subject: [PATCH 2/7] Revert to old mypy cache --- src/trio/_tests/test_exports.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/trio/_tests/test_exports.py b/src/trio/_tests/test_exports.py index 0414d4342..c5a5960bd 100644 --- a/src/trio/_tests/test_exports.py +++ b/src/trio/_tests/test_exports.py @@ -52,6 +52,9 @@ def _ensure_mypy_cache_updated() -> None: "--config-file=", "--cache-dir=./.mypy_cache", "--no-error-summary", + # TODO: update our tests to use the exposed APIs + # instead of reading JSON + "--no-fixed-format-cache", "-c", "import trio", ], From 428cef0e9914b7db74797eb14966d32889059a9a Mon Sep 17 00:00:00 2001 From: A5rocks Date: Mon, 6 Apr 2026 04:03:53 -0400 Subject: [PATCH 3/7] Oops, there was another cache change --- src/trio/_tests/test_exports.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/trio/_tests/test_exports.py b/src/trio/_tests/test_exports.py index c5a5960bd..0e978b4dc 100644 --- a/src/trio/_tests/test_exports.py +++ b/src/trio/_tests/test_exports.py @@ -53,8 +53,9 @@ def _ensure_mypy_cache_updated() -> None: "--cache-dir=./.mypy_cache", "--no-error-summary", # TODO: update our tests to use the exposed APIs - # instead of reading JSON + # instead of reading JSON... or use dmypy? "--no-fixed-format-cache", + "--no-sqlite-cache", "-c", "import trio", ], From 1fc9ea786fca42dfc870dac29147ecd9920b8e24 Mon Sep 17 00:00:00 2001 From: A5rocks Date: Mon, 6 Apr 2026 04:18:39 -0400 Subject: [PATCH 4/7] Handle typing changes --- src/trio/_core/_local.py | 5 ++--- src/trio/_core/_tests/test_asyncgen.py | 2 ++ src/trio/_path.py | 3 ++- src/trio/_socket.py | 2 +- src/trio/_util.py | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/trio/_core/_local.py b/src/trio/_core/_local.py index fff1234f5..21bb913cd 100644 --- a/src/trio/_core/_local.py +++ b/src/trio/_core/_local.py @@ -49,12 +49,11 @@ def get(self, default: T | type[_NoValue] = _NoValue) -> T: raise RuntimeError("Cannot be used outside of a run context") from None except KeyError: # contextvars consistency - # `type: ignore` awaiting https://github.com/python/mypy/issues/15553 to be fixed & released if default is not _NoValue: - return default # type: ignore[return-value] + return default if self._default is not _NoValue: - return self._default # type: ignore[return-value] + return self._default raise LookupError(self) from None diff --git a/src/trio/_core/_tests/test_asyncgen.py b/src/trio/_core/_tests/test_asyncgen.py index 91ca0250a..f9c190d49 100644 --- a/src/trio/_core/_tests/test_asyncgen.py +++ b/src/trio/_core/_tests/test_asyncgen.py @@ -306,10 +306,12 @@ def test_delegation_to_existing_hooks() -> None: def my_firstiter(agen: AsyncGenerator[object, NoReturn]) -> None: assert isinstance(agen, AsyncGeneratorType) + assert agen.ag_frame is not None record.append("firstiter " + agen.ag_frame.f_locals["arg"]) def my_finalizer(agen: AsyncGenerator[object, NoReturn]) -> None: assert isinstance(agen, AsyncGeneratorType) + assert agen.ag_frame is not None record.append("finalizer " + agen.ag_frame.f_locals["arg"]) async def example(arg: str) -> AsyncGenerator[int, None]: diff --git a/src/trio/_path.py b/src/trio/_path.py index 21e33eaae..7376c529e 100644 --- a/src/trio/_path.py +++ b/src/trio/_path.py @@ -263,8 +263,9 @@ def __repr__(self) -> str: if sys.version_info >= (3, 13): full_match = _wrap_method(pathlib.Path.full_match) + # TODO: only allow this for Python <3.19. def as_uri(self) -> str: - return pathlib.Path.as_uri(self) + return pathlib.PurePath.as_uri(self) if Path.relative_to.__doc__: # pragma: no branch diff --git a/src/trio/_socket.py b/src/trio/_socket.py index 68bbd4b6b..504874553 100644 --- a/src/trio/_socket.py +++ b/src/trio/_socket.py @@ -338,7 +338,7 @@ def fromshare(info: bytes) -> SocketType: else: FamilyDefault: None = None FamilyT: TypeAlias = int | AddressFamily | None - TypeT: TypeAlias = _stdlib_socket.socket | int + TypeT: TypeAlias = _stdlib_socket.SocketKind | int @_wraps(_stdlib_socket.socketpair, assigned=(), updated=()) diff --git a/src/trio/_util.py b/src/trio/_util.py index 8c10362f9..bae6608d8 100644 --- a/src/trio/_util.py +++ b/src/trio/_util.py @@ -298,7 +298,8 @@ def name_asyncgen(agen: AsyncGeneratorType[object, NoReturn]) -> str: if not hasattr(agen, "ag_code"): # pragma: no cover return repr(agen) try: - module = agen.ag_frame.f_globals["__name__"] + # `agen.ag_frame` can be None, but we catch AttributeError. + module = agen.ag_frame.f_globals["__name__"] # type: ignore[union-attr] except (AttributeError, KeyError): module = f"<{agen.ag_code.co_filename}>" try: From 934caf77bda0010421147f60d720397b81bdebcd Mon Sep 17 00:00:00 2001 From: A5rocks Date: Mon, 6 Apr 2026 04:39:14 -0400 Subject: [PATCH 5/7] Push off more work --- src/trio/_tests/test_path.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/trio/_tests/test_path.py b/src/trio/_tests/test_path.py index 9fe3920df..2ca834f59 100644 --- a/src/trio/_tests/test_path.py +++ b/src/trio/_tests/test_path.py @@ -230,6 +230,10 @@ async def test_globmethods(path: trio.Path) -> None: assert entries == {"_bar.txt", "bar.txt"} +@pytest.mark.xfail( + sys.version_info >= (3, 14), + reason="we need to update `as_uri` to use Path.as_uri" +) async def test_as_uri(path: trio.Path) -> None: path = await path.parent.resolve() From 614a5a54abf13278343498109091e377106ad73d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 08:39:56 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/trio/_tests/test_path.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/trio/_tests/test_path.py b/src/trio/_tests/test_path.py index 2ca834f59..d042438c8 100644 --- a/src/trio/_tests/test_path.py +++ b/src/trio/_tests/test_path.py @@ -231,8 +231,7 @@ async def test_globmethods(path: trio.Path) -> None: @pytest.mark.xfail( - sys.version_info >= (3, 14), - reason="we need to update `as_uri` to use Path.as_uri" + sys.version_info >= (3, 14), reason="we need to update `as_uri` to use Path.as_uri" ) async def test_as_uri(path: trio.Path) -> None: path = await path.parent.resolve() From 7da40d49b84076bed769002c65c5733076b9134f Mon Sep 17 00:00:00 2001 From: A5rocks Date: Mon, 6 Apr 2026 04:40:54 -0400 Subject: [PATCH 7/7] Oops --- src/trio/_tests/test_path.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/trio/_tests/test_path.py b/src/trio/_tests/test_path.py index d042438c8..82e8c548c 100644 --- a/src/trio/_tests/test_path.py +++ b/src/trio/_tests/test_path.py @@ -2,6 +2,7 @@ import os import pathlib +import sys from typing import TYPE_CHECKING import pytest