Compare commits
3 Commits
71cf9e7bd3
...
3b39cce741
Author | SHA1 | Date |
---|---|---|
Tyler Goodlet | 3b39cce741 | |
Tyler Goodlet | 110a023a03 | |
Tyler Goodlet | 89127614d5 |
|
@ -83,15 +83,13 @@ async def main(
|
||||||
debug_mode=True,
|
debug_mode=True,
|
||||||
maybe_enable_greenback=True,
|
maybe_enable_greenback=True,
|
||||||
# loglevel='devx',
|
# loglevel='devx',
|
||||||
# loglevel='runtime',
|
|
||||||
) as n:
|
) as n:
|
||||||
|
|
||||||
ptl: Portal = await n.start_actor(
|
ptl: Portal = await n.start_actor(
|
||||||
'aio_daemon',
|
'aio_daemon',
|
||||||
enable_modules=[__name__],
|
enable_modules=[__name__],
|
||||||
infect_asyncio=True,
|
infect_asyncio=True,
|
||||||
debug_mode=True,
|
debug_mode=True,
|
||||||
loglevel='cancel',
|
# loglevel='cancel',
|
||||||
)
|
)
|
||||||
|
|
||||||
async with ptl.open_context(
|
async with ptl.open_context(
|
||||||
|
|
|
@ -2491,10 +2491,7 @@ def pause_from_sync(
|
||||||
message += (
|
message += (
|
||||||
f'-> called from a root-actor bg {thread}\n'
|
f'-> called from a root-actor bg {thread}\n'
|
||||||
)
|
)
|
||||||
elif is_aio:
|
|
||||||
message += (
|
|
||||||
f'-> called from a `asyncio`-task bg {thread}\n'
|
|
||||||
)
|
|
||||||
message += (
|
message += (
|
||||||
'-> scheduling `._pause_from_bg_root_thread()`..\n'
|
'-> scheduling `._pause_from_bg_root_thread()`..\n'
|
||||||
)
|
)
|
||||||
|
@ -2516,7 +2513,6 @@ def pause_from_sync(
|
||||||
**_pause_kwargs,
|
**_pause_kwargs,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trio_token=trio.lowlevel.current_trio_token(),
|
|
||||||
)
|
)
|
||||||
DebugStatus.shield_sigint()
|
DebugStatus.shield_sigint()
|
||||||
message += (
|
message += (
|
||||||
|
@ -2552,6 +2548,7 @@ def pause_from_sync(
|
||||||
elif is_aio:
|
elif is_aio:
|
||||||
greenback: ModuleType = maybe_import_greenback()
|
greenback: ModuleType = maybe_import_greenback()
|
||||||
repl_owner: Task = asyncio.current_task()
|
repl_owner: Task = asyncio.current_task()
|
||||||
|
DebugStatus.shield_sigint()
|
||||||
fute: asyncio.Future = run_trio_task_in_future(
|
fute: asyncio.Future = run_trio_task_in_future(
|
||||||
partial(
|
partial(
|
||||||
_pause,
|
_pause,
|
||||||
|
@ -2567,6 +2564,7 @@ def pause_from_sync(
|
||||||
**_pause_kwargs
|
**_pause_kwargs
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: for async version -> `.pause_from_aio()`?
|
# TODO: for async version -> `.pause_from_aio()`?
|
||||||
# bg_task, _ = await fute
|
# bg_task, _ = await fute
|
||||||
bg_task, _ = greenback.await_(fute)
|
bg_task, _ = greenback.await_(fute)
|
||||||
|
@ -2701,8 +2699,7 @@ _crash_msg: str = (
|
||||||
|
|
||||||
|
|
||||||
def _post_mortem(
|
def _post_mortem(
|
||||||
# provided and passed by `_pause()`
|
repl: PdbREPL, # normally passed by `_pause()`
|
||||||
repl: PdbREPL,
|
|
||||||
|
|
||||||
# XXX all `partial`-ed in by `post_mortem()` below!
|
# XXX all `partial`-ed in by `post_mortem()` below!
|
||||||
tb: TracebackType,
|
tb: TracebackType,
|
||||||
|
@ -3019,7 +3016,17 @@ def open_crash_handler(
|
||||||
yield
|
yield
|
||||||
except tuple(catch) as err:
|
except tuple(catch) as err:
|
||||||
if type(err) not in ignore:
|
if type(err) not in ignore:
|
||||||
pdbp.xpm()
|
|
||||||
|
# use our re-impl-ed version
|
||||||
|
_post_mortem(
|
||||||
|
repl=mk_pdb(),
|
||||||
|
tb=sys.exc_info()[2],
|
||||||
|
api_frame=inspect.currentframe().f_back,
|
||||||
|
)
|
||||||
|
|
||||||
|
# XXX NOTE, `pdbp`'s version seems to lose the up-stack
|
||||||
|
# tb-info?
|
||||||
|
# pdbp.xpm()
|
||||||
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue