@@ -474,13 +474,15 @@ the original TOS1.
474474.. opcode :: END_ASYNC_FOR
475475
476476 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
478478 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
480480 from the stack. An exception handler block is removed from the block stack.
481481
482482 .. versionadded :: 3.8
483483
484+ .. versionchanged :: 3.11
485+ Exception representation on the stack now consist of one, not three, items.
484486
485487.. opcode :: BEFORE_ASYNC_WITH
486488
@@ -561,8 +563,10 @@ iterations of the loop.
561563
562564.. opcode :: POP_EXCEPT
563565
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.
565567
568+ .. versionchanged :: 3.11
569+ Exception representation on the stack now consist of one, not three, items.
566570
567571.. opcode :: RERAISE
568572
@@ -572,27 +576,32 @@ iterations of the loop.
572576
573577 .. versionadded :: 3.9
574578
579+ .. versionchanged :: 3.11
580+ Exception representation on the stack now consist of one, not three, items.
575581
576582.. opcode :: PUSH_EXC_INFO
577583
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.
580586 Used in exception handlers.
581587
582588 .. versionadded :: 3.11
583589
584590
585591.. opcode :: WITH_EXCEPT_START
586592
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 .
589595 Used to implement the call ``context_manager.__exit__(*exc_info()) `` when an exception
590596 has occurred in a :keyword: `with ` statement.
591597
592598 .. versionadded :: 3.9
593599 .. versionchanged :: 3.11
594600 The ``__exit__ `` function is in position 8 of the stack rather than 7.
595601
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.
596605
597606.. opcode :: POP_EXCEPT_AND_RERAISE
598607
@@ -890,10 +899,9 @@ All of the following opcodes use their arguments.
890899 Performs exception matching for ``except* ``. Applies ``split(TOS) `` on
891900 the exception group representing TOS1. Jumps if no match is found.
892901
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.
897905
898906 .. versionadded :: 3.11
899907
@@ -903,8 +911,8 @@ All of the following opcodes use their arguments.
903911 Combines the raised and reraised exceptions list from TOS, into an exception
904912 group to propagate from a try-except* block. Uses the original exception
905913 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.
908916
909917 .. versionadded :: 3.11
910918
0 commit comments