aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-08-05 11:24:22 +0200
committerGitHub <noreply@github.com>2024-08-05 09:24:22 +0000
commit8f19be47b6a50059924e1d7b64277ad3cef4dac7 (patch)
tree22923ab12c9ef1abd1c49d555dbdcc39ba193d3b
parent[3.12] Add `3.13` and remove `3.7` in Azure Pipelines (GH-122670) (#122672) (diff)
downloadcpython-8f19be47b6a50059924e1d7b64277ad3cef4dac7.tar.gz
cpython-8f19be47b6a50059924e1d7b64277ad3cef4dac7.tar.bz2
cpython-8f19be47b6a50059924e1d7b64277ad3cef4dac7.zip
[3.12] gh-121367: [doc] BUILD_TUPLE arg can be 0 (GH-122663) (#122684)
gh-121367: [doc] BUILD_TUPLE arg can be 0 (GH-122663) (cherry picked from commit 1422500d020bd199b26357fc387f8b79b82226cd) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
-rw-r--r--Doc/library/dis.rst12
1 files changed, 8 insertions, 4 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index c5f46079295..96e959f9bf3 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -995,11 +995,15 @@ iterations of the loop.
.. opcode:: BUILD_TUPLE (count)
Creates a tuple consuming *count* items from the stack, and pushes the
- resulting tuple onto the stack.::
+ resulting tuple onto the stack::
- assert count > 0
- STACK, values = STACK[:-count], STACK[-count:]
- STACK.append(tuple(values))
+ if count == 0:
+ value = ()
+ else:
+ STACK = STACK[:-count]
+ value = tuple(STACK[-count:])
+
+ STACK.append(value)
.. opcode:: BUILD_LIST (count)