Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/trio/_core/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/trio/_core/_tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
3 changes: 2 additions & 1 deletion src/trio/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=())
Expand Down
4 changes: 4 additions & 0 deletions src/trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ 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... or use dmypy?
"--no-fixed-format-cache",
"--no-sqlite-cache",
"-c",
"import trio",
],
Expand Down
4 changes: 4 additions & 0 deletions src/trio/_tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import pathlib
import sys
from typing import TYPE_CHECKING

import pytest
Expand Down Expand Up @@ -230,6 +231,9 @@ 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()

Expand Down
3 changes: 2 additions & 1 deletion src/trio/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading