Skip to content

Commit 1422500

Browse files
authored
gh-121367: [doc] BUILD_TUPLE arg can be 0 (#122663)
1 parent 5207adf commit 1422500

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
@@ -1081,11 +1081,15 @@ iterations of the loop.
10811081
.. opcode:: BUILD_TUPLE (count)
10821082

10831083
Creates a tuple consuming *count* items from the stack, and pushes the
1084-
resulting tuple onto the stack.::
1084+
resulting tuple onto the stack::
10851085

1086-
assert count > 0
1087-
STACK, values = STACK[:-count], STACK[-count:]
1088-
STACK.append(tuple(values))
1086+
if count == 0:
1087+
value = ()
1088+
else:
1089+
STACK = STACK[:-count]
1090+
value = tuple(STACK[-count:])
1091+
1092+
STACK.append(value)
10891093

10901094

10911095
.. opcode:: BUILD_LIST (count)

0 commit comments

Comments
 (0)