Skip to content

Commit

Permalink
Removed a leftover mention of Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Oct 8, 2022
1 parent ac3e0ff commit 8952575
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/anyio/_backends/_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,8 @@ async def __aexit__(
async def _run_wrapped_task(
self, coro: Coroutine, task_status_future: asyncio.Future | None
) -> None:
# This is the code path for Python 3.6 and 3.7 on which asyncio freaks out if a
# task raises a BaseException.
# This is the code path for Python 3.7 on which asyncio freaks out if a task
# raises a BaseException.
__traceback_hide__ = __tracebackhide__ = True # noqa: F841
task = cast(asyncio.Task, current_task())
try:
Expand Down
19 changes: 19 additions & 0 deletions tests/test_from_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,22 @@ async def in_loop() -> None:
await to_thread.run_sync(portal.start_task_soon, in_loop)

assert not caplog.text

def test_raise_baseexception_from_task(
self, anyio_backend_name: str, anyio_backend_options: dict[str, Any]
) -> None:
"""
Test that when a task raises a BaseException, it does not trigger additional
exceptions when trying to close the portal.
"""

async def raise_baseexception() -> None:
raise BaseException("fatal error")

with pytest.raises(BaseException, match="fatal error"):
with start_blocking_portal(
anyio_backend_name, anyio_backend_options
) as portal:
with pytest.raises(BaseException, match="fatal error"):
portal.call(raise_baseexception)

0 comments on commit 8952575

Please sign in to comment.