diff options
author | Mark Shannon <mark@hotpy.org> | 2020-01-27 09:57:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 09:57:45 (GMT) |
commit | 8a4cd700a7426341c2074a2b580306d2d60ec839 (patch) | |
tree | 64ff9fdc0361fe05e0ef5a2508e832a5de03b830 /Doc/library/dis.rst | |
parent | 72b1004657e60c900e4cd031b2635b587f4b280e (diff) | |
download | cpython-8a4cd700a7426341c2074a2b580306d2d60ec839.zip cpython-8a4cd700a7426341c2074a2b580306d2d60ec839.tar.gz cpython-8a4cd700a7426341c2074a2b580306d2d60ec839.tar.bz2 |
bpo-39320: Handle unpacking of **values in compiler (GH-18141)
* Add DICT_UPDATE and DICT_MERGE bytecodes. Use them for ** unpacking.
* Remove BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL, as they are now unused.
* Update magic number for ** unpacking opcodes.
* Update dis.rst to incorporate new bytecodes.
* Add blurb entry.
Diffstat (limited to 'Doc/library/dis.rst')
-rw-r--r-- | Doc/library/dis.rst | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index d5d30a0..61233d9 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -873,32 +873,25 @@ All of the following opcodes use their arguments. .. versionadded:: 3.9 -.. opcode:: SET_UPDATE +.. opcode:: SET_UPDATE (i) Calls ``set.update(TOS1[-i], TOS)``. Used to build sets. .. versionadded:: 3.9 -.. opcode:: BUILD_MAP_UNPACK (count) +.. opcode:: DICT_UPDATE (i) - Pops *count* mappings from the stack, merges them into a single dictionary, - and pushes the result. Implements dictionary unpacking in dictionary - displays ``{**x, **y, **z}``. + Calls ``dict.update(TOS1[-i], TOS)``. Used to build dicts. - .. versionadded:: 3.5 + .. versionadded:: 3.9 -.. opcode:: BUILD_MAP_UNPACK_WITH_CALL (count) +.. opcode:: DICT_MERGE - This is similar to :opcode:`BUILD_MAP_UNPACK`, - but is used for ``f(**x, **y, **z)`` call syntax. The stack item at - position ``count + 2`` should be the corresponding callable ``f``. + Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys. - .. versionadded:: 3.5 - .. versionchanged:: 3.6 - The position of the callable is determined by adding 2 to the opcode - argument instead of encoding it in the second byte of the argument. + .. versionadded:: 3.9 .. opcode:: LOAD_ATTR (namei) |