Compare commits
2 Commits
4fca7317ea
...
d716c57234
Author | SHA1 | Date |
---|---|---|
|
d716c57234 | |
|
7695e79cb8 |
|
@ -4,6 +4,11 @@ import sys
|
||||||
import trio
|
import trio
|
||||||
import tractor
|
import tractor
|
||||||
|
|
||||||
|
# ensure mod-path is correct!
|
||||||
|
from tractor.devx.debug import (
|
||||||
|
_sync_pause_from_builtin as _sync_pause_from_builtin,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def main() -> None:
|
async def main() -> None:
|
||||||
|
|
||||||
|
@ -13,6 +18,7 @@ async def main() -> None:
|
||||||
|
|
||||||
async with tractor.open_nursery(
|
async with tractor.open_nursery(
|
||||||
debug_mode=True,
|
debug_mode=True,
|
||||||
|
loglevel='devx',
|
||||||
) as an:
|
) as an:
|
||||||
assert an
|
assert an
|
||||||
assert (
|
assert (
|
||||||
|
|
|
@ -61,6 +61,7 @@ dev = [
|
||||||
# `tractor.devx` tooling
|
# `tractor.devx` tooling
|
||||||
"greenback>=1.2.1,<2",
|
"greenback>=1.2.1,<2",
|
||||||
"stackscope>=0.2.2,<0.3",
|
"stackscope>=0.2.2,<0.3",
|
||||||
|
"typing-extensions>=4.13.2", # needed for stackscope
|
||||||
"pyperclip>=1.9.0",
|
"pyperclip>=1.9.0",
|
||||||
"prompt-toolkit>=3.0.50",
|
"prompt-toolkit>=3.0.50",
|
||||||
"xonsh>=0.19.2",
|
"xonsh>=0.19.2",
|
||||||
|
|
|
@ -237,7 +237,7 @@ def enable_stack_on_sig(
|
||||||
try:
|
try:
|
||||||
import stackscope
|
import stackscope
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.warning(
|
log.error(
|
||||||
'`stackscope` not installed for use in debug mode!'
|
'`stackscope` not installed for use in debug mode!'
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
@ -255,8 +255,8 @@ def enable_stack_on_sig(
|
||||||
dump_tree_on_sig,
|
dump_tree_on_sig,
|
||||||
)
|
)
|
||||||
log.devx(
|
log.devx(
|
||||||
'Enabling trace-trees on `SIGUSR1` '
|
f'Enabling trace-trees on `SIGUSR1` '
|
||||||
'since `stackscope` is installed @ \n'
|
f'since `stackscope` is installed @ \n'
|
||||||
f'{stackscope!r}\n\n'
|
f'{stackscope!r}\n\n'
|
||||||
f'With `SIGUSR1` handler\n'
|
f'With `SIGUSR1` handler\n'
|
||||||
f'|_{dump_tree_on_sig}\n'
|
f'|_{dump_tree_on_sig}\n'
|
||||||
|
|
|
@ -144,6 +144,7 @@ def _post_mortem(
|
||||||
__tracebackhide__: bool = hide_tb
|
__tracebackhide__: bool = hide_tb
|
||||||
|
|
||||||
with _maybe_open_repl_fixture(
|
with _maybe_open_repl_fixture(
|
||||||
|
repl=repl,
|
||||||
repl_fixture=repl_fixture,
|
repl_fixture=repl_fixture,
|
||||||
boxed_maybe_exc=boxed_maybe_exc,
|
boxed_maybe_exc=boxed_maybe_exc,
|
||||||
) as enter_repl:
|
) as enter_repl:
|
||||||
|
|
|
@ -90,6 +90,7 @@ if TYPE_CHECKING:
|
||||||
Actor,
|
Actor,
|
||||||
)
|
)
|
||||||
from ._post_mortem import BoxedMaybeException
|
from ._post_mortem import BoxedMaybeException
|
||||||
|
from ._repl import PdbREPL
|
||||||
|
|
||||||
log = get_logger(__package__)
|
log = get_logger(__package__)
|
||||||
|
|
||||||
|
@ -109,6 +110,11 @@ _repl_fail_msg: str|None = (
|
||||||
# |_https://docs.python.org/3/library/contextlib.html#using-a-context-manager-as-a-function-decorator
|
# |_https://docs.python.org/3/library/contextlib.html#using-a-context-manager-as-a-function-decorator
|
||||||
@cm
|
@cm
|
||||||
def _maybe_open_repl_fixture(
|
def _maybe_open_repl_fixture(
|
||||||
|
repl: PdbREPL,
|
||||||
|
# ^XXX **always provided** by the low-level REPL-invoker,
|
||||||
|
# - _post_mortem()
|
||||||
|
# - _pause()
|
||||||
|
|
||||||
repl_fixture: (
|
repl_fixture: (
|
||||||
AbstractContextManager[bool]
|
AbstractContextManager[bool]
|
||||||
|None
|
|None
|
||||||
|
@ -134,7 +140,10 @@ def _maybe_open_repl_fixture(
|
||||||
repl_fixture
|
repl_fixture
|
||||||
or
|
or
|
||||||
rt_repl_fixture
|
rt_repl_fixture
|
||||||
)(maybe_bxerr=boxed_maybe_exc)
|
)(
|
||||||
|
repl=repl,
|
||||||
|
maybe_bxerr=boxed_maybe_exc
|
||||||
|
)
|
||||||
|
|
||||||
with _repl_fixture as enter_repl:
|
with _repl_fixture as enter_repl:
|
||||||
|
|
||||||
|
@ -252,6 +261,7 @@ async def _pause(
|
||||||
# nonlocal repl_fixture
|
# nonlocal repl_fixture
|
||||||
|
|
||||||
with _maybe_open_repl_fixture(
|
with _maybe_open_repl_fixture(
|
||||||
|
repl=repl,
|
||||||
repl_fixture=repl_fixture,
|
repl_fixture=repl_fixture,
|
||||||
) as enter_repl:
|
) as enter_repl:
|
||||||
if not enter_repl:
|
if not enter_repl:
|
||||||
|
|
Loading…
Reference in New Issue