@@ -474,13 +474,15 @@ the original TOS1.
474
474
.. opcode :: END_ASYNC_FOR
475
475
476
476
Terminates an :keyword: `async for ` loop. Handles an exception raised
477
- when awaiting a next item. If TOS is :exc: `StopAsyncIteration ` pop 7
477
+ when awaiting a next item. If TOS is :exc: `StopAsyncIteration ` pop 3
478
478
values from the stack and restore the exception state using the second
479
- three of them. Otherwise re-raise the exception using the three values
479
+ of them. Otherwise re-raise the exception using the value
480
480
from the stack. An exception handler block is removed from the block stack.
481
481
482
482
.. versionadded :: 3.8
483
483
484
+ .. versionchanged :: 3.11
485
+ Exception representation on the stack now consist of one, not three, items.
484
486
485
487
.. opcode :: BEFORE_ASYNC_WITH
486
488
@@ -561,8 +563,10 @@ iterations of the loop.
561
563
562
564
.. opcode :: POP_EXCEPT
563
565
564
- Pops three values from the stack, which are used to restore the exception state.
566
+ Pops a value from the stack, which is used to restore the exception state.
565
567
568
+ .. versionchanged :: 3.11
569
+ Exception representation on the stack now consist of one, not three, items.
566
570
567
571
.. opcode :: RERAISE
568
572
@@ -572,27 +576,32 @@ iterations of the loop.
572
576
573
577
.. versionadded :: 3.9
574
578
579
+ .. versionchanged :: 3.11
580
+ Exception representation on the stack now consist of one, not three, items.
575
581
576
582
.. opcode :: PUSH_EXC_INFO
577
583
578
- Pops the three values from the stack. Pushes the current exception to the top of the stack.
579
- Pushes the three values originally popped back to the stack.
584
+ Pops a value from the stack. Pushes the current exception to the top of the stack.
585
+ Pushes the value originally popped back to the stack.
580
586
Used in exception handlers.
581
587
582
588
.. versionadded :: 3.11
583
589
584
590
585
591
.. opcode :: WITH_EXCEPT_START
586
592
587
- Calls the function in position 8 on the stack with the top three
588
- items on the stack as arguments .
593
+ Calls the function in position 4 on the stack with arguments (type, val, tb)
594
+ representing the exception at the top of the stack .
589
595
Used to implement the call ``context_manager.__exit__(*exc_info()) `` when an exception
590
596
has occurred in a :keyword: `with ` statement.
591
597
592
598
.. versionadded :: 3.9
593
599
.. versionchanged :: 3.11
594
600
The ``__exit__ `` function is in position 8 of the stack rather than 7.
595
601
602
+ .. versionchanged :: 3.11
603
+ The ``__exit__ `` function is in position 4 of the stack rather than 7.
604
+ Exception representation on the stack now consist of one, not three, items.
596
605
597
606
.. opcode :: POP_EXCEPT_AND_RERAISE
598
607
@@ -890,10 +899,9 @@ All of the following opcodes use their arguments.
890
899
Performs exception matching for ``except* ``. Applies ``split(TOS) `` on
891
900
the exception group representing TOS1. Jumps if no match is found.
892
901
893
- Pops one item from the stack. If a match was found, pops the 3 items representing
894
- the exception and pushes the 3 items representing the non-matching part of
895
- the exception group, followed by the 3 items representing the matching part.
896
- In other words, in case of a match it pops 4 items and pushes 6.
902
+ Pops one item from the stack (the match type). If a match was found,
903
+ next item (the exception) and pushes the non-matching part of the
904
+ exception group followed by the matching part.
897
905
898
906
.. versionadded :: 3.11
899
907
@@ -903,8 +911,8 @@ All of the following opcodes use their arguments.
903
911
Combines the raised and reraised exceptions list from TOS, into an exception
904
912
group to propagate from a try-except* block. Uses the original exception
905
913
group from TOS1 to reconstruct the structure of reraised exceptions. Pops
906
- two items from the stack and pushes a triplet representing the exception to
907
- reraise or three ``None `` if there isn't one.
914
+ two items from the stack and pushes 0 (for lasti, which is unused) followed
915
+ by the exception to reraise or ``None `` if there isn't one.
908
916
909
917
.. versionadded :: 3.11
910
918
0 commit comments