@@ -706,50 +706,21 @@ iterations of the loop.
706
706
popped values are used to restore the exception state.
707
707
708
708
709
- .. opcode :: POP_FINALLY (preserve_tos)
709
+ .. opcode :: RERAISE
710
710
711
- Cleans up the value stack and the block stack. If *preserve_tos * is not
712
- ``0 `` TOS first is popped from the stack and pushed on the stack after
713
- performing other stack operations:
711
+ Re-raises the exception currently on top of the stack.
714
712
715
- * If TOS is ``NULL `` or an integer (pushed by :opcode: `BEGIN_FINALLY `
716
- or :opcode: `CALL_FINALLY `) it is popped from the stack.
717
- * If TOS is an exception type (pushed when an exception has been raised)
718
- 6 values are popped from the stack, the last three popped values are
719
- used to restore the exception state. An exception handler block is
720
- removed from the block stack.
713
+ .. versionadded :: 3.8
721
714
722
- It is similar to :opcode: `END_FINALLY `, but doesn't change the bytecode
723
- counter nor raise an exception. Used for implementing :keyword: `break `,
724
- :keyword: `continue ` and :keyword: `return ` in the :keyword: `finally ` block.
725
715
726
- .. versionadded :: 3.8
727
-
728
-
729
- .. opcode :: BEGIN_FINALLY
730
-
731
- Pushes ``NULL `` onto the stack for using it in :opcode: `END_FINALLY `,
732
- :opcode: `POP_FINALLY `, :opcode: `WITH_CLEANUP_START ` and
733
- :opcode: `WITH_CLEANUP_FINISH `. Starts the :keyword: `finally ` block.
734
-
735
- .. versionadded :: 3.8
716
+ .. opcode :: WITH_EXCEPT_START
736
717
718
+ Calls the function in position 7 on the stack with the top three
719
+ items on the stack as arguments.
720
+ Used to implement the call ``context_manager.__exit__(*exc_info()) `` when an exception
721
+ has occurred in a :keyword: `with ` statement.
737
722
738
- .. opcode :: END_FINALLY
739
-
740
- Terminates a :keyword: `finally ` clause. The interpreter recalls whether the
741
- exception has to be re-raised or execution has to be continued depending on
742
- the value of TOS.
743
-
744
- * If TOS is ``NULL `` (pushed by :opcode: `BEGIN_FINALLY `) continue from
745
- the next instruction. TOS is popped.
746
- * If TOS is an integer (pushed by :opcode: `CALL_FINALLY `), sets the
747
- bytecode counter to TOS. TOS is popped.
748
- * If TOS is an exception type (pushed when an exception has been raised)
749
- 6 values are popped from the stack, the first three popped values are
750
- used to re-raise the exception and the last three popped values are used
751
- to restore the exception state. An exception handler block is removed
752
- from the block stack.
723
+ .. versionadded :: 3.8
753
724
754
725
755
726
.. opcode :: LOAD_ASSERTION_ERROR
@@ -780,35 +751,6 @@ iterations of the loop.
780
751
.. versionadded :: 3.2
781
752
782
753
783
- .. opcode :: WITH_CLEANUP_START
784
-
785
- Starts cleaning up the stack when a :keyword: `with ` statement block exits.
786
-
787
- At the top of the stack are either ``NULL `` (pushed by
788
- :opcode: `BEGIN_FINALLY `) or 6 values pushed if an exception has been
789
- raised in the with block. Below is the context manager's
790
- :meth: `~object.__exit__ ` or :meth: `~object.__aexit__ ` bound method.
791
-
792
- If TOS is ``NULL ``, calls ``SECOND(None, None, None) ``,
793
- removes the function from the stack, leaving TOS, and pushes ``None ``
794
- to the stack. Otherwise calls ``SEVENTH(TOP, SECOND, THIRD) ``,
795
- shifts the bottom 3 values of the stack down, replaces the empty spot
796
- with ``NULL `` and pushes TOS. Finally pushes the result of the call.
797
-
798
-
799
- .. opcode :: WITH_CLEANUP_FINISH
800
-
801
- Finishes cleaning up the stack when a :keyword: `with ` statement block exits.
802
-
803
- TOS is result of ``__exit__() `` or ``__aexit__() `` function call pushed
804
- by :opcode: `WITH_CLEANUP_START `. SECOND is ``None `` or an exception type
805
- (pushed when an exception has been raised).
806
-
807
- Pops two values from the stack. If SECOND is not None and TOS is true
808
- unwinds the EXCEPT_HANDLER block which was created when the exception
809
- was caught and pushes ``NULL `` to the stack.
810
-
811
-
812
754
All of the following opcodes use their arguments.
813
755
814
756
.. opcode :: STORE_NAME (namei)
@@ -1060,15 +1002,6 @@ All of the following opcodes use their arguments.
1060
1002
stack. *delta * points to the finally block or the first except block.
1061
1003
1062
1004
1063
- .. opcode :: CALL_FINALLY (delta)
1064
-
1065
- Pushes the address of the next instruction onto the stack and increments
1066
- bytecode counter by *delta *. Used for calling the finally block as a
1067
- "subroutine".
1068
-
1069
- .. versionadded :: 3.8
1070
-
1071
-
1072
1005
.. opcode :: LOAD_FAST (var_num)
1073
1006
1074
1007
Pushes a reference to the local ``co_varnames[var_num] `` onto the stack.
0 commit comments