Skip to content
19 changes: 19 additions & 0 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,25 @@ iterations of the loop.
.. versionadded:: 3.13


.. opcode:: MATCH_CLASS_ISINSTANCE

Read match subject ``Stack[-2]`` and the type object ``Stack[-1]`` from stack.
Pop ``Stack[-1]`` and push ``True`` or ``False`` for the result of :func:`isinstance`.

.. versionadded:: 3.15


.. opcode:: MATCH_CLASS_GET_OPT_ATTR (namei)

Replaces ``STACK[-1]`` with ``getattr(STACK[-1], co_names[namei])`` and get
optional attribute from match subject ``STACK[-2]``.

Pop ``Stack[-1]``. If attribute is found, push it and ``True`` onto the stack.
Otherwise push ``None`` and ``False``.

.. versionadded:: 3.15


.. opcode:: MATCH_CLASS (count)

``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the class
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_magic_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ Known values:
Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization)
Python 3.15a4 3660 (Change generator preamble code)
Python 3.15a4 3661 (Lazy imports IMPORT_NAME opcode changes)
Python 3.15a7 3662 (Add MATCH_CLASS_ISINSTANCE & MATCH_CLASS_GET_OPT_ATTR)


Python 3.16 will start with 3700
Expand All @@ -305,7 +306,7 @@ PC/launcher.c must also be updated.

*/

#define PYC_MAGIC_NUMBER 3661
#define PYC_MAGIC_NUMBER 3662
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
20 changes: 16 additions & 4 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading