Skip to content

Commit b985122

Browse files
committed
Bump version to 0.24.0
1 parent a10f94b commit b985122

File tree

8 files changed

+23
-147
lines changed

8 files changed

+23
-147
lines changed

docs/source/history.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ Release history
55

66
.. towncrier release notes start
77
8+
Trio 0.24.0 (2024-01-10)
9+
------------------------
10+
11+
Features
12+
~~~~~~~~
13+
14+
- New helper classes: :class:`~.testing.RaisesGroup` and :class:`~.testing.Matcher`.
15+
16+
In preparation for changing the default of ``strict_exception_groups`` to `True`, we're introducing a set of helper classes that can be used in place of `pytest.raises <https://docs.pytest.org/en/stable/reference/reference.html#pytest.raises>`_ in tests, to check for an expected `ExceptionGroup`.
17+
These are provisional, and only planned to be supplied until there's a good solution in ``pytest``. See https://github.com/pytest-dev/pytest/issues/11538 (`#2785 <https://github.com/python-trio/trio/issues/2785>`__)
18+
19+
20+
Deprecations and removals
21+
~~~~~~~~~~~~~~~~~~~~~~~~~
22+
23+
- ``MultiError`` has been fully removed, and all relevant trio functions now raise ExceptionGroups instead. This should not affect end users that have transitioned to using ``except*`` or catching ExceptionGroup/BaseExceptionGroup. (`#2891 <https://github.com/python-trio/trio/issues/2891>`__)
24+
25+
826
Trio 0.23.2 (2023-12-14)
927
------------------------
1028

newsfragments/2785.feature.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

newsfragments/2891.deprecated.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/trio/_subprocess.py

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
import trio
1313

14-
from ._abc import AsyncResource, ReceiveStream, SendStream
1514
from ._core import ClosedResourceError, TaskStatus
16-
from ._deprecate import deprecated
1715
from ._highlevel_generic import StapledStream
1816
from ._subprocess_platform import (
1917
create_pipe_from_child_output,
@@ -28,7 +26,9 @@
2826
from collections.abc import Awaitable, Callable, Mapping, Sequence
2927
from io import TextIOWrapper
3028

31-
from typing_extensions import Self, TypeAlias
29+
from typing_extensions import TypeAlias
30+
31+
from ._abc import ReceiveStream, SendStream
3232

3333

3434
# Sphinx cannot parse the stringified version
@@ -101,7 +101,7 @@ def fileno(self) -> int:
101101

102102

103103
@final
104-
class Process(AsyncResource, metaclass=NoPublicConstructor):
104+
class Process(metaclass=NoPublicConstructor):
105105
r"""A child process. Like :class:`subprocess.Popen`, but async.
106106
107107
This class has no public constructor. The most common way to get a
@@ -223,41 +223,6 @@ def returncode(self) -> int | None:
223223
self._close_pidfd()
224224
return result
225225

226-
@deprecated(
227-
"0.20.0",
228-
thing="using trio.Process as an async context manager",
229-
issue=1104,
230-
instead="run_process or nursery.start(run_process, ...)",
231-
)
232-
async def __aenter__(self) -> Self:
233-
return self
234-
235-
# Type ignore is for `Type of decorated function contains type "Any" ("Callable[[Process], Coroutine[Any, Any, None]]")`
236-
@deprecated(
237-
"0.20.0", issue=1104, instead="run_process or nursery.start(run_process, ...)"
238-
)
239-
async def aclose(self) -> None: # type: ignore[misc]
240-
"""Close any pipes we have to the process (both input and output)
241-
and wait for it to exit.
242-
243-
If cancelled, kills the process and waits for it to finish
244-
exiting before propagating the cancellation.
245-
"""
246-
with trio.CancelScope(shield=True):
247-
if self.stdin is not None:
248-
await self.stdin.aclose()
249-
if self.stdout is not None:
250-
await self.stdout.aclose()
251-
if self.stderr is not None:
252-
await self.stderr.aclose()
253-
try:
254-
await self.wait()
255-
finally:
256-
if self._proc.returncode is None:
257-
self.kill()
258-
with trio.CancelScope(shield=True):
259-
await self.wait()
260-
261226
def _close_pidfd(self) -> None:
262227
if self._pidfd is not None:
263228
trio.lowlevel.notify_closing(self._pidfd.fileno())

src/trio/_tests/test_deprecate.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -260,32 +260,3 @@ def test_module_with_deprecations(recwarn_always: pytest.WarningsRecorder) -> No
260260

261261
with pytest.raises(AttributeError):
262262
module_with_deprecations.asdf # type: ignore[attr-defined] # noqa: B018 # "useless expression"
263-
264-
265-
def test_tests_is_deprecated1() -> None:
266-
with pytest.warns(TrioDeprecationWarning):
267-
from trio import tests # warning on import
268-
269-
# warning on access of any member
270-
with pytest.warns(TrioDeprecationWarning):
271-
assert tests.test_abc # type: ignore[attr-defined]
272-
273-
274-
def test_tests_is_deprecated2() -> None:
275-
# warning on direct import of test since that accesses `__spec__`
276-
with pytest.warns(TrioDeprecationWarning):
277-
import trio.tests
278-
279-
with pytest.warns(TrioDeprecationWarning):
280-
assert trio.tests.test_deprecate # type: ignore[attr-defined]
281-
282-
283-
def test_tests_is_deprecated3() -> None:
284-
import trio
285-
286-
# no warning on accessing the submodule
287-
assert trio.tests
288-
289-
# only when accessing a submodule member
290-
with pytest.warns(TrioDeprecationWarning):
291-
assert trio.tests.test_abc # type: ignore[attr-defined]

src/trio/_tests/test_subprocess.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import pytest
2323

2424
from .. import (
25-
ClosedResourceError,
2625
Event,
2726
Process,
2827
_core,
@@ -168,38 +167,6 @@ async def test_multi_wait(background_process: BackgroundProcessType) -> None:
168167
proc.kill()
169168

170169

171-
# Test for deprecated 'async with process:' semantics
172-
async def test_async_with_basics_deprecated(recwarn: pytest.WarningsRecorder) -> None:
173-
async with await open_process(
174-
CAT, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
175-
) as proc:
176-
pass
177-
assert proc.returncode is not None
178-
assert proc.stdin is not None
179-
assert proc.stdout is not None
180-
assert proc.stderr is not None
181-
with pytest.raises(ClosedResourceError):
182-
await proc.stdin.send_all(b"x")
183-
with pytest.raises(ClosedResourceError):
184-
await proc.stdout.receive_some()
185-
with pytest.raises(ClosedResourceError):
186-
await proc.stderr.receive_some()
187-
188-
189-
# Test for deprecated 'async with process:' semantics
190-
async def test_kill_when_context_cancelled(recwarn: pytest.WarningsRecorder) -> None:
191-
with move_on_after(100) as scope:
192-
async with await open_process(SLEEP(10)) as proc:
193-
assert proc.poll() is None
194-
scope.cancel()
195-
await sleep_forever()
196-
assert scope.cancelled_caught
197-
assert got_signal(proc, SIGKILL)
198-
assert repr(proc) == "<trio.Process {!r}: {}>".format(
199-
SLEEP(10), "exited with signal 9" if posix else "exited with status 1"
200-
)
201-
202-
203170
COPY_STDIN_TO_STDOUT_AND_BACKWARD_TO_STDERR = python(
204171
"data = sys.stdin.buffer.read(); "
205172
"sys.stdout.buffer.write(data); "

src/trio/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# This file is imported from __init__.py and parsed by setuptools
22

3-
__version__ = "0.23.2+dev"
3+
__version__ = "0.24.0"

src/trio/tests.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)