forked from goodboy/tractor
Comment all `.pause(shield=True)` attempts again, need to solve cancel scope `.__exit__()` frame hiding issue..
parent
575a24adf1
commit
6d951c526a
|
@ -631,6 +631,7 @@ def _set_trace(
|
|||
# no f!#$&* idea, but when we're in async land
|
||||
# we need 2x frames up?
|
||||
frame = frame.f_back
|
||||
# frame = frame.f_back
|
||||
|
||||
# if shield:
|
||||
# frame = frame.f_back
|
||||
|
@ -646,17 +647,19 @@ def _set_trace(
|
|||
# undo_
|
||||
|
||||
|
||||
|
||||
async def pause(
|
||||
|
||||
debug_func: Callable = _set_trace,
|
||||
release_lock_signal: trio.Event | None = None,
|
||||
|
||||
# allow caller to pause despite task cancellation,
|
||||
# TODO: allow caller to pause despite task cancellation,
|
||||
# exactly the same as wrapping with:
|
||||
# with CancelScope(shield=True):
|
||||
# await pause()
|
||||
shield: bool = False,
|
||||
# => the REMAINING ISSUE is that the scope's .__exit__() frame
|
||||
# is always show in the debugger on entry.. and there seems to
|
||||
# be no way to override it?..
|
||||
# shield: bool = False,
|
||||
|
||||
# TODO:
|
||||
# shield: bool = False
|
||||
|
@ -689,13 +692,22 @@ async def pause(
|
|||
):
|
||||
Lock.local_pdb_complete = trio.Event()
|
||||
|
||||
if shield:
|
||||
# if shield:
|
||||
debug_func = partial(
|
||||
debug_func,
|
||||
shield=shield,
|
||||
# shield=shield,
|
||||
)
|
||||
|
||||
with trio.CancelScope(shield=shield):
|
||||
# def _exit(self, *args, **kwargs):
|
||||
# __tracebackhide__: bool = True
|
||||
# super().__exit__(*args, **kwargs)
|
||||
|
||||
# trio.CancelScope.__exit__.__tracebackhide__ = True
|
||||
|
||||
# import types
|
||||
# with trio.CancelScope(shield=shield) as cs:
|
||||
# cs.__exit__ = types.MethodType(_exit, cs)
|
||||
# cs.__exit__.__tracebackhide__ = True
|
||||
|
||||
# TODO: need a more robust check for the "root" actor
|
||||
if (
|
||||
|
|
Loading…
Reference in New Issue