circuitpython/tests/basics/generator_pend_throw.py.exp
Jim Mussared 5578182ec9 py/objgenerator: Allow pend_throw to an unstarted generator.
Replace the is_running field with a tri-state variable to indicate
running/not-running/pending-exception.

Update tests to cover the various cases.

This allows cancellation in uasyncio even if the coroutine hasn't been
executed yet.  Fixes #5242
2019-11-04 15:51:16 +11:00

16 lines
246 B
Plaintext

0
1
raised ValueError()
ret was: None
raised OSError()
raised ValueError('generator already executing',)
raised ValueError('generator already executing',)
0
ignore CancelledError
1
raised CancelledError()
None
CancelledError()
CancelledError()
1