Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changelog

`CalVer, YY.month.patch <https://calver.org/>`_

24.9.5
======
- Fix crash when analyzing code with infinite loop inside context manager.

24.9.4
======
- Add :ref:`ASYNC122 <async122>` delayed-entry-of-relative-cancelscope.
Expand Down
2 changes: 1 addition & 1 deletion flake8_async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


# CalVer: YY.month.patch, e.g. first release of July 2022 == "22.7.1"
__version__ = "24.9.4"
__version__ = "24.9.5"


# taken from https://github.com/Zac-HD/shed
Expand Down
4 changes: 2 additions & 2 deletions flake8_async/visitors/visitor91x.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def error_91x(
node: cst.Return | cst.FunctionDef | cst.Yield,
statement: Statement,
) -> bool:
assert not isinstance(statement, ArtificialStatement)
assert not isinstance(statement, ArtificialStatement), statement

if isinstance(node, cst.FunctionDef):
msg = "exit"
Expand Down Expand Up @@ -768,7 +768,7 @@ def leave_While_body(self, node: cst.For | cst.While):
| self.uncheckpointed_statements
| self.loop_state.uncheckpointed_before_continue
):
if stmt == ARTIFICIAL_STATEMENT:
if isinstance(stmt, ArtificialStatement):
continue
any_error |= self.error_91x(err_node, stmt)

Expand Down
9 changes: 9 additions & 0 deletions tests/autofix_files/async100.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,12 @@ async def more_nested_tests():
async def foo():
with trio.fail_after(1):
yield


# This previously caused an AssertionError, see issue #295
async def fn(timeout):
with trio.fail_after(timeout):
while True:
if condition():
return
await trio.sleep(1)
9 changes: 9 additions & 0 deletions tests/eval_files/async100.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,12 @@ async def more_nested_tests():
async def foo():
with trio.fail_after(1):
yield


# This previously caused an AssertionError, see issue #295
async def fn(timeout):
with trio.fail_after(timeout):
while True:
if condition():
return
await trio.sleep(1)
Loading