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
35 changes: 35 additions & 0 deletions docs/source/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,41 @@ Release history

.. towncrier release notes start

trio 0.34.0 (2026-08-10)
------------------------

Features
~~~~~~~~

- `MemoryChannelStatistics` now has a ``peak_buffer_used`` field, which reports
the largest number of items that have ever been in the channel's buffer at
once. This makes it easier to pick a sensible ``max_buffer_size`` based on
data from a real run, instead of guessing. (`#1723 <https://github.com/python-trio/trio/issues/1723>`__)
- Support Python 3.15, as of beta 4. Things may still change and so this
support may break in the future. (`#3456 <https://github.com/python-trio/trio/issues/3456>`__)


Bugfixes
~~~~~~~~

- ``Nursery.start()`` now preserves the ``__cause__`` and ``__context__`` of
exceptions raised before ``task_status.started()`` is called. (`#3261 <https://github.com/python-trio/trio/issues/3261>`__)
- Fixed incorrect error message in ``run_process``: the ``stdout`` pipe check now correctly says "stdout" instead of "stdin". (`#3409 <https://github.com/python-trio/trio/issues/3409>`__)
- Fixed ``trio.Path.as_uri()`` on Python 3.14+ to avoid the deprecated ``pathlib.PurePath.as_uri()`` path. (`#3460 <https://github.com/python-trio/trio/issues/3460>`__)
- Fixed ``trio.to_thread.run_sync``` workers leaking spawner's ``Context`` on ``py314t+`` free-threaded builds. (`#3472 <https://github.com/python-trio/trio/issues/3472>`__)


Deprecations and removals
~~~~~~~~~~~~~~~~~~~~~~~~~

- Trying to use absolute deadlines on a `trio.CancelScope` constructed
with a relative deadline now raises, after being deprecated since Trio
0.27.0.

To switch a cancel scope from being relative to absolute, replace the
`trio.CancelScope` object instead of trying to mutate it. (`#3403 <https://github.com/python-trio/trio/issues/3403>`__)


trio 0.33.0 (2026-02-14)
------------------------

Expand Down
4 changes: 0 additions & 4 deletions newsfragments/1723.feature.rst

This file was deleted.

2 changes: 0 additions & 2 deletions newsfragments/3261.bugfix.rst

This file was deleted.

6 changes: 0 additions & 6 deletions newsfragments/3403.deprecated.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/3409.bugfix.rst

This file was deleted.

2 changes: 0 additions & 2 deletions newsfragments/3456.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/3460.bugfix.rst

This file was deleted.

1 change: 0 additions & 1 deletion newsfragments/3472.bugfix.rst

This file was deleted.

2 changes: 1 addition & 1 deletion src/trio/_core/_tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ async def test_fallback_when_no_hook_claims_it(
async def well_behaved() -> AsyncGenerator[int, None]:
yield 42

# noqas because we *want* to test delayed yield/await!
# these noqas are because we *want* to test delayed yield/await!
async def yields_after_yield() -> AsyncGenerator[int, None]:
with pytest.raises(GeneratorExit):
yield 42 # noqa: ASYNC119
Expand Down
34 changes: 4 additions & 30 deletions src/trio/_sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import math
from typing import TYPE_CHECKING, Literal, Protocol, TypeVar
from typing import TYPE_CHECKING, Literal, Protocol

import attrs

Expand All @@ -16,31 +16,13 @@
enable_ki_protection,
remove_parking_lot_breaker,
)
from ._deprecate import warn_deprecated
from ._util import final

if TYPE_CHECKING:
from collections.abc import Callable
from types import TracebackType

from typing_extensions import deprecated

from ._core import Task
from ._core._parking_lot import ParkingLotStatistics
else:
T = TypeVar("T")

def deprecated(
message: str,
/,
*,
category: type[Warning] | None = DeprecationWarning,
stacklevel: int = 1,
) -> Callable[[T], T]:
def wrapper(f: T) -> T:
return f

return wrapper


@attrs.frozen
Expand Down Expand Up @@ -130,19 +112,11 @@ def statistics(self) -> EventStatistics:
"""
return EventStatistics(tasks_waiting=len(self._tasks))

@deprecated(
"trio.Event.__bool__ is deprecated since Trio 0.31.0; use trio.Event.is_set instead (https://github.com/python-trio/trio/issues/3238)",
stacklevel=2,
)
def __bool__(self) -> Literal[True]:
"""Return True and raise warning."""
warn_deprecated(
self.__bool__,
"0.31.0",
issue=3238,
instead=self.is_set,
"""Raise error."""
raise NotImplementedError(
"Trio events cannot be treated as bools; consider using `event.is_set()` instead."
)
return True


class _HasAcquireRelease(Protocol):
Expand Down
5 changes: 1 addition & 4 deletions src/trio/_tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ async def test_Event() -> None:
assert not e.is_set()
assert e.statistics().tasks_waiting == 0

with pytest.warns(
DeprecationWarning,
match=r"trio\.Event\.__bool__ is deprecated since Trio 0\.31\.0; use trio\.Event\.is_set instead \(https://github.com/python-trio/trio/issues/3238\)",
):
with pytest.raises(NotImplementedError):
e.__bool__()

e.set()
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This file is imported from __init__.py and parsed by setuptools

__version__ = "0.33.0+dev"
__version__ = "0.34.0+dev"