Message408232
The YIELD_FROM instruction does three things:
* It sends a value to the sub-iterator
* It yields the value from the sub-iterator back up to its caller
* Loops back on itself
So we should implement this as:
SEND <--+
YIELD_VALUE |
JUMP_ABSOLUTE -+
Doing so would allow us to simplify gen.send and gen.throw as they wouldn't need all the special cases for 'yield from'.
Zero cost exception handling allows us to handle throw in the bytecode with no runtime overhead:
while True:
SEND -> exit
try:
YIELD_VALUE
except BaseException as ex:
sub_iterator.throw(ex)
exit: |
|
Date |
User |
Action |
Args |
2021-12-10 17:48:52 | Mark.Shannon | set | recipients:
+ Mark.Shannon |
2021-12-10 17:48:52 | Mark.Shannon | set | messageid: <1639158532.51.0.938199888812.issue46039@roundup.psfhosted.org> |
2021-12-10 17:48:52 | Mark.Shannon | link | issue46039 messages |
2021-12-10 17:48:52 | Mark.Shannon | create | |
|