- Update to 0.25.0
* New helper classes: RaisesGroup and Matcher.
* MultiError has been fully removed, and all relevant trio
functions now raise ExceptionGroups instead.
* The strict_exception_groups parameter now defaults to True
in trio.run and trio.lowlevel.start_guest_run.
* Add trio.testing.wait_all_threads_completed, which blocks
until no threads are running tasks.
* Path is now a subclass of pathlib.PurePath, allowing it to
interoperate with other standard pathlib types.
OBS-URL: https://build.opensuse.org/request/show/1160593
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=45
* TypeVarTuple is now used to fully type
:meth:`nursery.start_soon() <trio.Nursery.start_soon>`,
:func:`trio.run()`, :func:`trio.to_thread.run_sync()`, and
other similar functions accepting (func, *args). This means
type checkers will be able to verify types are used
correctly. :meth:`nursery.start() <trio.Nursery.start>` is
not fully typed yet however. (#2881)
* Make pyright recognize :func:`open_memory_channel` as
generic. (#2873)
backlink Unknown interpreted text role "func".
* Make pyright recognize :func:`open_memory_channel` as
generic.
* Unknown interpreted text role "func".
* Moved the metadata into PEP 621-compliant
:file:`pyproject.toml`. (#2860)
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=41
* Don't crash on import in Anaconda interpreters.
* Add type hints.
* When exiting a nursery block, the parent task always waits
for child tasks to exit. This wait cannot be cancelled. However,
previously, if you tried to cancel it, it *would* inject a
`Cancelled` exception, even though it wasn't cancelled.
Most users probably never noticed either way, but injecting a
`Cancelled` here is not really useful, and in some rare cases
caused confusion or problems, so Trio no longer does that.
* If called from a thread spawned by `trio.to_thread.run_sync`,
`trio.from_thread.run` and `trio.from_thread.run_sync` now
reuse the task and cancellation status of the host task;
* this means that context variables and cancel scopes naturally
propagate 'through' threads spawned by Trio. You can also use
`trio.from_thread.check_cancelled`
to efficiently check for cancellation without reentering the
Trio thread.
* :func:`trio.lowlevel.start_guest_run` now does a bit more
setup of the guest run before it returns to its caller,
so that the caller can immediately make calls to
:func:`trio.current_time`,
:func:`trio.lowlevel.spawn_system_task`,
:func:`trio.lowlevel.current_trio_token`, etc.
* When a starting function raises before calling
:func:`trio.TaskStatus.started`,
:func:`trio.Nursery.start` will no longer wrap the exception
in an undocumented :exc:`ExceptionGroup`.
* To better reflect the underlying thread handling semantics,
the keyword argument for `trio.to_thread.run_sync` that was
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=39
* Fix PermissionError when importing trio due to trying to
access pthread.
* Breaking change: Timeout functions now raise ValueError if
passed math.nan. This includes trio.sleep, trio.sleep_until,
trio.move_on_at, trio.move_on_after, trio.fail_at and
trio.fail_after.
* Added support for naming threads created with
trio.to_thread.run_sync, requires pthreads so is only
available on POSIX platforms with glibc installed.
* trio.socket.socket now prints the address it tried to connect
to upon failure.
* Fixed a crash that can occur when running Trio within an
embedded Python interpreter, by handling the TypeError that
is raised when trying to (re-)install a C signal handler.
* Fix sniffio.current_async_library() when Trio tasks are
spawned from a non-Trio context (such as when using
trio-asyncio). Previously, a regular Trio task would inherit
the non-Trio library name, and spawning a system task would
cause the non-Trio caller to start thinking it was Trio.
* Documented that Nursery.start_soon does not guarantee task
ordering.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=38
* MultiError has been deprecated in favor of the standard BaseExceptionGroup
(introduced in PEP 654). On Python versions below 3.11, this exception and
its derivative ExceptionGroup are provided by the backport. Trio still
raises MultiError, but it has been refactored into a subclass of
BaseExceptionGroup which users should catch instead of MultiError. Uses of
the MultiError.filter() class method should be replaced with
BaseExceptionGroup.split(). Uses of the MultiError.catch() class method
should be replaced with either except* clauses (on Python 3.11+) or the
exceptiongroup.catch() context manager provided by the backport.
See the updated documentation for details.
# Features
* Added support for Datagram TLS, for secure communication over UDP.
Currently requires PyOpenSSL. (#2010)
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=28
- Update to version 0.20.0
* You can now conveniently spawn a child process in a background
task and interact it with on the fly using process = await
nursery.start(run_process, ...). See run_process for more
details. We recommend most users switch to this new API. Also
note that:
- trio.open_process has been deprecated in favor of
trio.lowlevel.open_process,
- The aclose method on Process has been deprecated along with
async with process_obj. (#1104)
* Now context variables set with contextvars are preserved when
running functions in a worker thread with
trio.to_thread.run_sync, or when running functions from the
worker thread in the parent Trio thread with
trio.from_thread.run, and trio.from_thread.run_sync. This is
done by automatically copying the contextvars context.
trio.lowlevel.spawn_system_task now also receives an optional
context argument. (#2160)
* Trio now avoids creating cyclic garbage when a MultiError is
generated and filtered, including invisibly within the
cancellation system. This means errors raised through nurseries
and cancel scopes should result in less GC latency. (#2063)
* Trio now deterministically cleans up file descriptors that were
opened before subprocess creation fails. Previously, they would
remain open until the next run of the garbage collector.
(#2193)
* Add compatibility with OpenSSL 3.0 on newer Python and PyPy
versions by working around SSLEOFError not being raised
properly. (#2203)
* Fix a bug that could cause Process.wait to hang on Linux
OBS-URL: https://build.opensuse.org/request/show/965606
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=22
- Update to version 0.19.0
* Trio now supports Python 3.10. (#1921)
* Use slots for `~.lowlevel.Task` which should make them slightly
smaller and faster. (#1927)
* Make `~.Event` more lightweight by using less objects (about 2
rather than 5, including a nested ParkingLot and attribute
dicts) and simpler structures (set rather than OrderedDict).
This may benefit applications that create a large number of
event instances, such as with the "replace event object on
every set()" idiom. (#1948)
* The event loop now holds on to references of coroutine frames
for only the minimum necessary period of time. (#1864)
* The `~.lowlevel.TrioToken` class can now be used as a target of
a weak reference. (#1924)
- Release 0.18.0
* Add synchronous .close() methods and context manager (with x)
support for .MemorySendChannel and .MemoryReceiveChannel.
(#1797)
* Previously, on Windows, Trio programs using thousands of
sockets at the same time could trigger extreme slowdowns in the
Windows kernel. Now, Trio works around this issue, so you
should be able to use as many sockets as you want. (#1280)
* `trio.from_thread.run` no longer crashes the Trio run if it is
executed after the system nursery has been closed but before
the run has finished. Calls made at this time will now raise
trio.RunFinishedError. This fixes a regression introduced in
Trio 0.17.0. The window in question is only one scheduler tick
long in most cases, but may be longer if async generators need
to be cleaned up. (#1738)
* Fix a crash in pypy-3.7 (#1765)
OBS-URL: https://build.opensuse.org/request/show/940110
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=21
- Update to 0.16.0
* If you want to use Trio, but are stuck with some other event loop
like Qt or PyGame, then good news: now you can have both.
* To speed up `trio.to_thread.run_sync`, Trio now caches and re-uses
worker threads.
* Tasks spawned with `nursery.start() <trio.Nursery.start>` aren't treated as
direct children of their nursery until they call ``task_status.started()``.
* Some bugfixes and deprecations
OBS-URL: https://build.opensuse.org/request/show/822403
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=14
* Added a helpful error message if an async function is passed to
trio.from_thread.run_sync or a sync function to trio.from_thread.run. (#1244)
* Previously, when trio.run_process was cancelled, it always killed the subprocess immediately. Now, on Unix, it first gives the process a chance to clean up by sending SIGTERM, and only escalates to SIGKILL if the process is still running after 5 seconds. But if you prefer the old behavior, or want to adjust the timeout, then don't worry: you can now pass a custom deliver_cancel= argument to define your own process killing policy. (#1104)
* It turns out that creating a subprocess can block the parent process for a surprisingly long time. So trio.open_process now uses a worker thread to avoid blocking the event loop. (#1109)
* On Linux kernels v5.3 or newer, trio.Process.wait now uses the pidfd API to track child processes. This shouldn't have any user-visible change, but it makes working with subprocesses faster and use less memory. (#1241)
* The trio.Process.returncode attribute is now automatically updated as needed, instead of only when you call ~trio.Process.poll or ~trio.Process.wait. Also, repr(process_object) now always contains up-to-date information about the process status. (#1315)
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=12
* Use slots for memory channel state and statistics which should make
memory channels slightly smaller and faster.
* OpenSSL has a bug in its handling of TLS 1.3 session tickets that can cause
deadlocks or data loss in some rare edge cases. These edge cases most frequently
happen during tests.
* Trio now uses signal.set_wakeup_fd on all platforms.
* Trio no longer crashes when an async function is implemented in C or Cython
and then passed directly to trio.run or nursery.start_soon.
* When a Trio task makes improper use of a non-Trio async library, Trio nowi
causes an exception to be raised within the task at the point of the error,
rather than abandoning the task and raising an error in its parent.
This improves debuggability and resolves the TrioInternalError that would
sometimes result from the old strategy. (#552)
* In 0.12.0 we deprecated trio.run_sync_in_worker_thread in favor
of trio.to_thread.run_sync. But, the deprecation message listed the wrong
name for the replacement.
* Fix regression introduced with cancellation changes in 0.12.0, where
a trio.CancelScope which isn't cancelled could catch a propagating
trio.Cancelled exception if shielding were changed while the cancellation
was propagating.
* Fix a crash that could happen when using MockClock with autojump enabled
and a non-zero rate.
* If you nest >1000 cancel scopes within each other, Trio now handles that
gracefully instead of crashing with a RecursionError.
* Fixed the hash behavior of trio.Path to match pathlib.Path. Previously
trio.Path's hash was inherited from object instead of from pathlib.PurePath.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=10
- version update to 0.12.1
Features
* If you have a `~trio.abc.ReceiveStream` object, you can now use
``async for data in stream: ...`` instead of calling
`~trio.abc.ReceiveStream.receive_some`. Each iteration gives an
arbitrary sized chunk of bytes. And the best part is, the loop
automatically exits when you reach EOF, so you don't have to check for
it yourself anymore. Relatedly, you no longer need to pick a magic
buffer size value before calling
`~trio.abc.ReceiveStream.receive_some`; you can ``await
stream.receive_some()`` with no arguments, and the stream will
automatically pick a reasonable size for you. (`#959 <https://github.com/python-trio/trio/issues/959>`__)
* Threading interfaces have been reworked:
``run_sync_in_worker_thread`` is now `trio.to_thread.run_sync`, and
instead of ``BlockingTrioPortal``, use `trio.from_thread.run` and
`trio.from_thread.run_sync`. What's neat about this is that these
cooperate, so if you're in a thread created by `to_thread.run_sync`,
it remembers which Trio created it, and you can call
``trio.from_thread.*`` directly without having to pass around a
``BlockingTrioPortal`` object everywhere. (`#810 <https://github.com/python-trio/trio/issues/810>`__)
* We cleaned up the distinction between the "abstract channel interface"
and the "memory channel" concrete implementation.
`trio.abc.SendChannel` and `trio.abc.ReceiveChannel` have been slimmed
down, `trio.MemorySendChannel` and `trio.MemoryReceiveChannel` are now
public types that can be used in type hints, and there's a new
`trio.abc.Channel` interface for future bidirectional channels. (`#719 <https://github.com/python-trio/trio/issues/719>`__)
* Add :func:`trio.run_process` as a high-level helper for running a process
and waiting for it to finish, like the standard :func:`subprocess.run` does. (`#822 <https://github.com/python-trio/trio/issues/822>`__)
* On Linux, when wrapping a bare file descriptor in a Trio socket object,
Trio now auto-detects the correct ``family``, ``type``, and ``protocol``.
OBS-URL: https://build.opensuse.org/request/show/721060
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-trio?expand=0&rev=8