From 8bb2ab117faaa825f6e3b6f4ad685eb5d6afd785 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 10 May 2021 07:46:16 -0400 Subject: [PATCH] Add debug example that causes pdb stdin clobbering --- .../root_timeout_while_child_crashed.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/debugging/root_timeout_while_child_crashed.py diff --git a/examples/debugging/root_timeout_while_child_crashed.py b/examples/debugging/root_timeout_while_child_crashed.py new file mode 100644 index 0000000..09a9003 --- /dev/null +++ b/examples/debugging/root_timeout_while_child_crashed.py @@ -0,0 +1,31 @@ + +import trio +import tractor + + +async def key_error(): + "Raise a ``NameError``" + return {}['doggy'] + + +async def main(): + """Root dies + + """ + async with tractor.open_nursery( + debug_mode=True, + loglevel='debug' + ) as n: + + # spawn both actors + portal = await n.run_in_actor(key_error) + + # XXX: originally a bug causes by this + # where root would enter debugger even + # though child should have it locked. + with trio.fail_after(1): + await trio.Event().wait() + + +if __name__ == '__main__': + trio.run(main)