You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exempt async CM methods from ASYNC910/911 when partner checkpoints
ASYNC910 and ASYNC911 no longer require every `__aenter__`/`__aexit__` to
contain a checkpoint. Per Trio's documentation, an async context manager
only needs one of entry/exit to act as a checkpoint.
When a class defines both methods, the one without an `await` is exempt
if its partner contains one. When a class defines only one of the two,
the partner is charitably assumed to be inherited from a base class and
to contain a checkpoint, so the defined method is also exempt.
Closes#441https://claude.ai/code/session_014jAydKywq31Ew4fVYGJdiG
Copy file name to clipboardExpand all lines: docs/changelog.rst
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ Changelog
7
7
Unreleased
8
8
==========
9
9
- Autofix for :ref:`ASYNC910 <async910>` / :ref:`ASYNC911 <async911>` no longer inserts checkpoints inside ``except`` clauses (which would trigger :ref:`ASYNC120 <async120>`); instead the checkpoint is added at the top of the function or of the enclosing loop. `(issue #403) <https://github.com/python-trio/flake8-async/issues/403>`_
10
+
- :ref:`ASYNC910 <async910>` and :ref:`ASYNC911 <async911>` now accept ``__aenter__`` / ``__aexit__`` methods when the partner method provides the checkpoint, or when only one of the two is defined on a class that inherits from another class (charitably assuming the partner is inherited and contains a checkpoint). `(issue #441) <https://github.com/python-trio/flake8-async/issues/441>`_
0 commit comments