From e0fe2ebac09373e39fd3d98e7deb7e44e4936a52 Mon Sep 17 00:00:00 2001 From: tangyuan0821 Date: Mon, 25 Aug 2025 09:56:23 +0800 Subject: [PATCH 1/3] Remove obsolete (flags) from CALL_FUNCTION_EX docs --- Doc/library/dis.rst | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 7360f4aa804724..4ceee08be76f92 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1607,19 +1607,30 @@ iterations of the loop. .. versionadded:: 3.13 -.. opcode:: CALL_FUNCTION_EX (flags) - - Calls a callable object with variable set of positional and keyword - arguments. If the lowest bit of *flags* is set, the top of the stack - contains a mapping object containing additional keyword arguments. - Before the callable is called, the mapping object and iterable object - are each "unpacked" and their contents passed in as keyword and - positional arguments respectively. - ``CALL_FUNCTION_EX`` pops all arguments and the callable object off the stack, - calls the callable object with those arguments, and pushes the return value - returned by the callable object. - - .. versionadded:: 3.6 +.. opcode:: CALL_FUNCTION_EX + + Calls a callable object with a variable set of positional and keyword + arguments collected at runtime. It expects (in ascending order): + + * the callable object + * ``NULL`` (a marker used in the calling convention; may be elided in + optimized internal forms) + * a :class:`tuple` containing the positional arguments + * either ``NULL`` or a :class:`dict` containing the keyword arguments + + The positional arguments tuple and the keyword arguments dict are each + "unpacked" and passed to the callable. ``CALL_FUNCTION_EX`` pops all these + items and pushes the callable's return value. + + Earlier Python versions documented an integer *flags* operand indicating + the presence of a mapping object for keyword arguments; this no longer + applies. The opcode itself no longer has a separate operand or flag bits + for this purpose in Python 3.14 and later. + + .. versionadded:: 3.6 + .. versionchanged:: 3.14 + The obsolete *flags* argument was removed from the documentation; the + opcode no longer uses an operand to signal presence of ``**kwargs``. .. opcode:: PUSH_NULL From 655891a4265263bccb0c23296d015a3cb724c720 Mon Sep 17 00:00:00 2001 From: tangyuan0821 Date: Mon, 25 Aug 2025 16:18:14 +0800 Subject: [PATCH 2/3] Update the dis module documentation --- Doc/library/dis.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 4ceee08be76f92..47452c0c8d8860 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1621,16 +1621,14 @@ iterations of the loop. The positional arguments tuple and the keyword arguments dict are each "unpacked" and passed to the callable. ``CALL_FUNCTION_EX`` pops all these items and pushes the callable's return value. - - Earlier Python versions documented an integer *flags* operand indicating - the presence of a mapping object for keyword arguments; this no longer - applies. The opcode itself no longer has a separate operand or flag bits - for this purpose in Python 3.14 and later. + The presence of keyword arguments is indicated solely by whether the + last stack item is ``NULL`` or a :class:`dict`; there is no operand or + flag associated with this opcode. .. versionadded:: 3.6 .. versionchanged:: 3.14 - The obsolete *flags* argument was removed from the documentation; the - opcode no longer uses an operand to signal presence of ``**kwargs``. + The opcode no longer uses a flags operand to signal the presence of + ``**kwargs``; the stack layout alone determines this. .. opcode:: PUSH_NULL From 8ea7a0acd0c7f9aca61a3649d13c68f99a7f7ae5 Mon Sep 17 00:00:00 2001 From: tangyuan0821 Date: Mon, 25 Aug 2025 16:33:07 +0800 Subject: [PATCH 3/3] Fixing Indentation Errors in the dis Module Documentation --- Doc/library/dis.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 47452c0c8d8860..c23c73e3e16e1a 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1621,9 +1621,9 @@ iterations of the loop. The positional arguments tuple and the keyword arguments dict are each "unpacked" and passed to the callable. ``CALL_FUNCTION_EX`` pops all these items and pushes the callable's return value. - The presence of keyword arguments is indicated solely by whether the - last stack item is ``NULL`` or a :class:`dict`; there is no operand or - flag associated with this opcode. + The presence of keyword arguments is indicated solely by whether the + last stack item is ``NULL`` or a :class:`dict`; there is no operand or + flag associated with this opcode. .. versionadded:: 3.6 .. versionchanged:: 3.14