Add temp breakpoint support to `collapse_eg()`

strict_egs_everywhere
Tyler Goodlet 2025-08-05 16:44:58 -04:00
parent d9c8d543b3
commit 64c27a914b
1 changed files with 7 additions and 2 deletions

View File

@ -78,7 +78,6 @@ def collapse_exception_group(
def get_collapsed_eg( def get_collapsed_eg(
beg: BaseExceptionGroup, beg: BaseExceptionGroup,
bp: bool = False,
) -> BaseException|None: ) -> BaseException|None:
''' '''
If the input beg can collapse to a single sub-exception which is If the input beg can collapse to a single sub-exception which is
@ -92,7 +91,6 @@ def get_collapsed_eg(
return maybe_exc return maybe_exc
@acm @acm
async def collapse_eg( async def collapse_eg(
hide_tb: bool = True, hide_tb: bool = True,
@ -102,6 +100,8 @@ async def collapse_eg(
# trio.Cancelled, # trio.Cancelled,
}, },
add_notes: bool = True, add_notes: bool = True,
bp: bool = False,
): ):
''' '''
If `BaseExceptionGroup` raised in the body scope is If `BaseExceptionGroup` raised in the body scope is
@ -115,6 +115,11 @@ async def collapse_eg(
yield yield
except BaseExceptionGroup as _beg: except BaseExceptionGroup as _beg:
beg = _beg beg = _beg
if bp:
import tractor
await tractor.pause(shield=True)
if ( if (
(exc := get_collapsed_eg(beg)) (exc := get_collapsed_eg(beg))
and and