forked from goodboy/tractor
1
0
Fork 0

Add debug example that causes pdb stdin clobbering

ctx_debugger_from_hardening
Tyler Goodlet 2021-05-10 07:46:16 -04:00
parent cb1e208599
commit 8cc41090dd
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)