Skip to content

Commit 725a9cd

Browse files
[3.13] gh-121367: [doc] BUILD_TUPLE arg can be 0 (GH-122663) (#122683)
gh-121367: [doc] BUILD_TUPLE arg can be 0 (GH-122663) (cherry picked from commit 1422500) Co-authored-by: Irit Katriel <[email protected]>
1 parent 7a68296 commit 725a9cd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Doc/library/dis.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,15 @@ iterations of the loop.
11021102
.. opcode:: BUILD_TUPLE (count)
11031103

11041104
Creates a tuple consuming *count* items from the stack, and pushes the
1105-
resulting tuple onto the stack.::
1105+
resulting tuple onto the stack::
11061106

1107-
assert count > 0
1108-
STACK, values = STACK[:-count], STACK[-count:]
1109-
STACK.append(tuple(values))
1107+
if count == 0:
1108+
value = ()
1109+
else:
1110+
STACK = STACK[:-count]
1111+
value = tuple(STACK[-count:])
1112+
1113+
STACK.append(value)
11101114

11111115

11121116
.. opcode:: BUILD_LIST (count)

0 commit comments

Comments
 (0)