https://github.com/python/cpython/commit/1422500d020bd199b26357fc387f8b79b82226cd
commit: 1422500d020bd199b26357fc387f8b79b82226cd
branch: main
author: Irit Katriel <[email protected]>
committer: iritkatriel <[email protected]>
date: 2024-08-05T10:17:55+01:00
summary:

gh-121367: [doc] BUILD_TUPLE arg can be 0 (#122663)

files:
M Doc/library/dis.rst

diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 26b13c87181000..440ca233584e57 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -1081,11 +1081,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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to