Skip to content

Commit

Permalink
PEP 789: minor expression edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed May 31, 2024
1 parent c1a2d27 commit c37ea4f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions peps/pep-0789.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ When we run this code, we see the expected sequence of observations, then a
...
File "demo.py", line 37, in turn_on_lights_when_someone_gets_home
await asyncio.sleep(1) # do some other operation
^^^^^^^^^^^^^^^^^^^^^^
File ".../python3.11/asyncio/tasks.py", line 649, in sleep
return await future
asyncio.exceptions.CancelledError
Expand Down Expand Up @@ -487,7 +486,7 @@ Anticipated uses
================

In the standard library, ``sys.prevent_yields`` could be used by
``asyncio.TaskGroup``, ``asycio.timeout``, and ``asyncio.timeout_at``.
``asyncio.TaskGroup``, ``asyncio.timeout``, and ``asyncio.timeout_at``.
Downstream, we expect to use it in ``trio.CancelScope``, async fixtures (in
pytest-trio, anyio, etc.), and perhaps other places.

Expand Down Expand Up @@ -579,7 +578,7 @@ PEP 533, deterministic cleanup for iterators
essentially wrapping a ``with [a]closing(ait)`` around each (async) for loop.
While this would be useful for ensuring timely and deterministic cleanup of
resources held by iterators, the problem it aims to solve, it does not fully
address the issues that motivate PEP 789.
address the issues that motivate this PEP.

Even with PEP 533, misfired cancellations would still be delivered to the wrong
task and could wreak havoc before the iterator is closed. Moreover, it does not
Expand Down Expand Up @@ -657,8 +656,8 @@ language.

.. _just-deliver:

Can't we just deliver exceptions to the _right_ place?
------------------------------------------------------
Can't we just deliver exceptions to the right place?
----------------------------------------------------

If we implemented :pep:`568` (Generator-sensitivity for Context Variables; see
also :pep:`550`), it would be possible to handle exceptions from timeouts: the
Expand Down

0 comments on commit c37ea4f

Please sign in to comment.