summaryrefslogtreecommitdiffstats
path: root/Doc/library/dis.rst
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2020-01-27 09:57:45 (GMT)
committerGitHub <noreply@github.com>2020-01-27 09:57:45 (GMT)
commit8a4cd700a7426341c2074a2b580306d2d60ec839 (patch)
tree64ff9fdc0361fe05e0ef5a2508e832a5de03b830 /Doc/library/dis.rst
parent72b1004657e60c900e4cd031b2635b587f4b280e (diff)
downloadcpython-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.rst21
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)