From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:37:16 +0000 (+0200) Subject: [3.13] gh-121367: [doc] BUILD_TUPLE arg can be 0 (GH-122663) (#122683) X-Git-Tag: v3.13.0rc2~185 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=725a9cd10b568ae95381b11c7a432cf07d8700ad;p=thirdparty%2FPython%2Fcpython.git [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 1422500d020bd199b26357fc387f8b79b82226cd) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> --- diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index f3b39330b8ea..a899e16a0167 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1102,11 +1102,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)