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
* add async121 control-flow-in-taskgroup
* bump __version__
* aaand fix the version # in the changelog
* reword the description after feedback from oremanj
* enable rule for asyncio, add more details to rule explanation. Extend tests to be more thorough with state management.
* also check AsyncFor, restructure tests
Copy file name to clipboardExpand all lines: docs/rules.rst
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,9 @@ _`ASYNC120` : await-in-except
83
83
This will not trigger when :ref:`ASYNC102 <ASYNC102>` does, and if you don't care about losing non-cancelled exceptions you could disable this rule.
84
84
This is currently not able to detect asyncio shields.
85
85
86
+
_`ASYNC121`: control-flow-in-taskgroup
87
+
`return`, `continue`, and `break` inside a :ref:`taskgroup_nursery` can lead to counterintuitive behaviour. Refactor the code to instead cancel the :ref:`cancel_scope` inside the TaskGroup/Nursery and place the statement outside of the TaskGroup/Nursery block. In asyncio a user might expect the statement to have an immediate effect, but it will wait for all tasks to finish before having an effect. See `Trio issue #1493 <https://github.com/python-trio/trio/issues/1493>` for further issues specific to trio/anyio.
0 commit comments