@@ -772,8 +772,13 @@ All of the following opcodes use their arguments.
772
772
773
773
.. opcode :: BUILD_MAP (count)
774
774
775
- Pushes a new dictionary object onto the stack. The dictionary is pre-sized
776
- to hold *count * entries.
775
+ Pushes a new dictionary object onto the stack. Pops ``2 * count `` items
776
+ so that the dictionary holds *count * entries:
777
+ ``{..., TOS3: TOS2, TOS1: TOS} ``.
778
+
779
+ .. versionchanged :: 3.5
780
+ The dictionary is created from stack items instead of creating an
781
+ empty dictionary pre-sized to hold *count * items.
777
782
778
783
779
784
.. opcode :: BUILD_CONST_KEY_MAP (count)
@@ -793,6 +798,52 @@ All of the following opcodes use their arguments.
793
798
.. versionadded :: 3.6
794
799
795
800
801
+ .. opcode :: BUILD_TUPLE_UNPACK (count)
802
+
803
+ Pops *count * iterables from the stack, joins them in a single tuple,
804
+ and pushes the result. Implements iterable unpacking in tuple
805
+ displays ``(*x, *y, *z) ``.
806
+
807
+ .. versionadded :: 3.5
808
+
809
+
810
+ .. opcode :: BUILD_LIST_UNPACK (count)
811
+
812
+ This is similar to :opcode: `BUILD_TUPLE_UNPACK `, but pushes a list
813
+ instead of tuple. Implements iterable unpacking in list
814
+ displays ``[*x, *y, *z] ``.
815
+
816
+ .. versionadded :: 3.5
817
+
818
+
819
+ .. opcode :: BUILD_SET_UNPACK (count)
820
+
821
+ This is similar to :opcode: `BUILD_TUPLE_UNPACK `, but pushes a set
822
+ instead of tuple. Implements iterable unpacking in set
823
+ displays ``{*x, *y, *z} ``.
824
+
825
+ .. versionadded :: 3.5
826
+
827
+
828
+ .. opcode :: BUILD_MAP_UNPACK (count)
829
+
830
+ Pops *count * mappings from the stack, merges them into a single dictionary,
831
+ and pushes the result. Implements dictionary unpacking in dictionary
832
+ displays ``{**x, **y, **z} ``.
833
+
834
+ .. versionadded :: 3.5
835
+
836
+
837
+ .. opcode :: BUILD_MAP_UNPACK_WITH_CALL (oparg)
838
+
839
+ This is similar to :opcode: `BUILD_MAP_UNPACK `,
840
+ but is used for ``f(**x, **y, **z) `` call syntax. The lowest byte of
841
+ *oparg * is the count of mappings, the relative position of the
842
+ corresponding callable ``f `` is encoded in the second byte of *oparg *.
843
+
844
+ .. versionadded :: 3.5
845
+
846
+
796
847
.. opcode :: LOAD_ATTR (namei)
797
848
798
849
Replaces TOS with ``getattr(TOS, co_names[namei]) ``.
0 commit comments