From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:17:55 +0000 (+0100) Subject: gh-121367: [doc] BUILD_TUPLE arg can be 0 (#122663) X-Git-Tag: v3.14.0a1~883 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1422500d020bd199b26357fc387f8b79b82226cd;p=thirdparty%2FPython%2Fcpython.git gh-121367: [doc] BUILD_TUPLE arg can be 0 (#122663) --- diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 26b13c871810..440ca233584e 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)