trio icon indicating copy to clipboard operation
trio copied to clipboard

"Cancel scope stack corrupted" is thrown when recursion depth exceeded

Open catern opened this issue 5 years ago • 0 comments

The following code:

import trio

def f():
    with trio.move_on_after(1):
        f()

trio.run(f)

Fails with:

RuntimeError: Cancel scope stack corrupted: attempted to exit <trio.CancelScope at 0x7f451b880130, active, deadline is 1.00 seconds from now> in <Task '<init>' at 0x7f451ba35ed0> that's still within its child <trio.CancelScope at 0x7f451b880210, active, deadline is 1.00 seconds from now>

Way up the stack trace, there's also a RecursionError: maximum recursion depth exceeded in comparison. Neither of those are the errors I'd expect; I'd expect a simple RecursionError: maximum recursion depth exceeded.

catern avatar Dec 12 '20 20:12 catern