Add debug example that causes pdb stdin clobbering

ctx_debugger
Tyler Goodlet 2021-05-10 07:46:16 -04:00
parent 49d439b681
commit 63bdddd0c9
1 changed files with 31 additions and 0 deletions

View File

@ -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)