@@ -616,13 +616,6 @@ the original TOS1.
616
616
.. versionadded :: 3.5
617
617
618
618
619
- .. opcode :: SETUP_ASYNC_WITH
620
-
621
- Creates a new frame object.
622
-
623
- .. versionadded :: 3.5
624
-
625
-
626
619
627
620
**Miscellaneous opcodes **
628
621
@@ -692,28 +685,29 @@ iterations of the loop.
692
685
opcode implements ``from module import * ``.
693
686
694
687
695
- .. opcode :: POP_BLOCK
696
-
697
- Removes one block from the block stack. Per frame, there is a stack of
698
- blocks, denoting :keyword: `try ` statements, and such.
699
-
700
-
701
688
.. opcode :: POP_EXCEPT
702
689
703
- Removes one block from the block stack. The popped block must be an exception
704
- handler block, as implicitly created when entering an except handler. In
705
- addition to popping extraneous values from the frame stack, the last three
706
- popped values are used to restore the exception state.
690
+ Pops three values from the stack, which are used to restore the exception state.
707
691
708
692
709
693
.. opcode :: RERAISE
710
694
711
695
Re-raises the exception currently on top of the stack. If oparg is non-zero,
712
- restores ``f_lasti `` of the current frame to its value when the exception was raised.
696
+ pops an additional value from the stack which is used to set ``f_lasti ``
697
+ of the current frame.
713
698
714
699
.. versionadded :: 3.9
715
700
716
701
702
+ .. opcode :: PUSH_EXC_INFO
703
+
704
+ Pops the three values from the stack. Pushes the current exception to the top of the stack.
705
+ Pushes the three values originally popped back to the stack.
706
+ Used in exception handlers.
707
+
708
+ .. versionadded :: 3.11
709
+
710
+
717
711
.. opcode :: WITH_EXCEPT_START
718
712
719
713
Calls the function in position 7 on the stack with the top three
@@ -724,6 +718,17 @@ iterations of the loop.
724
718
.. versionadded :: 3.9
725
719
726
720
721
+ .. opcode :: POP_EXCEPT_AND_RERAISE
722
+
723
+ Pops the exception currently on top of the stack. Pops the integer value on top
724
+ of the stack and sets the ``f_lasti `` attribute of the frame with that value.
725
+ Then pops the next exception from the stack uses it to restore the current exception.
726
+ Finally it re-raises the originally popped exception.
727
+ Used in excpetion handler cleanup.
728
+
729
+ .. versionadded :: 3.11
730
+
731
+
727
732
.. opcode :: LOAD_ASSERTION_ERROR
728
733
729
734
Pushes :exc: `AssertionError ` onto the stack. Used by the :keyword: `assert `
@@ -738,18 +743,15 @@ iterations of the loop.
738
743
by :opcode: `CALL_FUNCTION ` to construct a class.
739
744
740
745
741
- .. opcode :: SETUP_WITH (delta)
746
+ .. opcode :: BEFORE_WITH (delta)
742
747
743
748
This opcode performs several operations before a with block starts. First,
744
749
it loads :meth: `~object.__exit__ ` from the context manager and pushes it onto
745
750
the stack for later use by :opcode: `WITH_EXCEPT_START `. Then,
746
- :meth: `~object.__enter__ ` is called, and a finally block pointing to *delta *
747
- is pushed. Finally, the result of calling the ``__enter__() `` method is pushed onto
748
- the stack. The next opcode will either ignore it (:opcode: `POP_TOP `), or
749
- store it in (a) variable(s) (:opcode: `STORE_FAST `, :opcode: `STORE_NAME `, or
750
- :opcode: `UNPACK_SEQUENCE `).
751
+ :meth: `~object.__enter__ ` is called. Finally, the result of calling the
752
+ ``__enter__() `` method is pushed onto the stack.
751
753
752
- .. versionadded :: 3.2
754
+ .. versionadded :: 3.11
753
755
754
756
755
757
.. opcode :: COPY_DICT_WITHOUT_KEYS
@@ -1039,12 +1041,6 @@ All of the following opcodes use their arguments.
1039
1041
Loads the global named ``co_names[namei] `` onto the stack.
1040
1042
1041
1043
1042
- .. opcode :: SETUP_FINALLY (delta)
1043
-
1044
- Pushes a try block from a try-finally or try-except clause onto the block
1045
- stack. *delta * points to the finally block or the first except block.
1046
-
1047
-
1048
1044
.. opcode :: LOAD_FAST (var_num)
1049
1045
1050
1046
Pushes a reference to the local ``co_varnames[var_num] `` onto the stack.
0 commit comments