From fe3a123bc38c6f5f5d335bc2febddaaef417f109 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 6 Aug 2026 13:33:36 +0200 Subject: [PATCH 1/4] gh-152105: Remove PyUnstable_ExecutableKinds and related macros (GH-155244) --- Doc/c-api/frame.rst | 38 ------------------- Doc/tools/removed-ids.txt | 7 ++++ Doc/whatsnew/3.16.rst | 9 +++++ Include/cpython/pyframe.h | 8 ---- ...-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst | 6 +++ Python/frame.c | 8 ---- 6 files changed, 22 insertions(+), 54 deletions(-) create mode 100644 Misc/NEWS.d/next/C_API/2026-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst diff --git a/Doc/c-api/frame.rst b/Doc/c-api/frame.rst index 70a610cea82d06..4159ff6e5965fb 100644 --- a/Doc/c-api/frame.rst +++ b/Doc/c-api/frame.rst @@ -243,41 +243,3 @@ Unless using :pep:`523`, you will not need this. Return the currently executing line number, or -1 if there is no line number. .. versionadded:: 3.12 - - -.. c:var:: const PyTypeObject *PyUnstable_ExecutableKinds - - An array of executable kinds (executor types) for frames, used for internal - debugging and tracing. - - Tools like debuggers and profilers can use this to identify the type of execution - context associated with a frame (such as to filter out internal frames). - The entries are indexed by the following constants: - - .. list-table:: - :header-rows: 1 - :widths: auto - - * - Constant - - Description - * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP - - The frame is internal (For example: inlined) and should be skipped by tools. - * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION - - The frame corresponds to a standard Python function. - * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION - - The frame corresponds to a function defined in native code. - * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR - - The frame corresponds to a method on a class instance. - - Note that reading the executable kind from a frame is currently only - possible with undocumented internal APIs. - - .. versionadded:: 3.13 - - -.. c:macro:: PyUnstable_EXECUTABLE_KINDS - - The number of entries in :c:data:`PyUnstable_ExecutableKinds`. - - .. versionadded:: 3.13 - diff --git a/Doc/tools/removed-ids.txt b/Doc/tools/removed-ids.txt index 7796d15f4d2735..3801e6d31199d6 100644 --- a/Doc/tools/removed-ids.txt +++ b/Doc/tools/removed-ids.txt @@ -23,6 +23,13 @@ using/configure.html: cmdoption-with-system-libmpdec library/symtable.html: symtable.Class.get_methods library/sys.html: sys._enablelegacywindowsfsencoding c-api/import.html: c.PyImport_LazyImportsMode.PyImport_LAZY_NONE +c-api/frame.html: c.PyUnstable_EXECUTABLE_KINDS +c-api/frame.html: c.PyUnstable_ExecutableKinds +c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION +c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR +c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_PY_FUNCTION +c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_SKIP + ## Old names for grammar tokens reference/expressions.html: grammar-token-python-grammar-comp_for diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 90ab6758a264cd..210bcafe65f5e9 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -872,3 +872,12 @@ Deprecated C APIs Removed C APIs -------------- + +* The :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros + :c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`, + :c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`, + :c:macro:`!PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION`, + :c:macro:`!PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR` and + :c:macro:`!PyUnstable_EXECUTABLE_KINDS`, were removed. + + (Contributed by Peters Bierma and Viktorin in :gh:`152105`.) diff --git a/Include/cpython/pyframe.h b/Include/cpython/pyframe.h index 51529763923ec3..24a947de1ede1e 100644 --- a/Include/cpython/pyframe.h +++ b/Include/cpython/pyframe.h @@ -35,11 +35,3 @@ PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame /* Returns the currently executing line number, or -1 if there is no line number. * Does not raise an exception. */ PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame); - -#define PyUnstable_EXECUTABLE_KIND_SKIP 0 -#define PyUnstable_EXECUTABLE_KIND_PY_FUNCTION 1 -#define PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION 3 -#define PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR 4 -#define PyUnstable_EXECUTABLE_KINDS 5 - -PyAPI_DATA(const PyTypeObject *) const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1]; diff --git a/Misc/NEWS.d/next/C_API/2026-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst b/Misc/NEWS.d/next/C_API/2026-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst new file mode 100644 index 00000000000000..5440389ce5bbb8 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2026-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst @@ -0,0 +1,6 @@ +Remove the :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros +:c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`, +:c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`, +:c:macro:`!PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION`, +:c:macro:`!PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR` and +:c:macro:`!PyUnstable_EXECUTABLE_KINDS`, from the C API. diff --git a/Python/frame.c b/Python/frame.c index ff81eb0b3020c7..ba8222417d208c 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -149,11 +149,3 @@ PyUnstable_InterpreterFrame_GetLine(_PyInterpreterFrame *frame) int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT); return PyCode_Addr2Line(_PyFrame_GetCode(frame), addr); } - -const PyTypeObject *const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1] = { - [PyUnstable_EXECUTABLE_KIND_SKIP] = &_PyNone_Type, - [PyUnstable_EXECUTABLE_KIND_PY_FUNCTION] = &PyCode_Type, - [PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION] = &PyMethod_Type, - [PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR] = &PyMethodDescr_Type, - [PyUnstable_EXECUTABLE_KINDS] = NULL, -}; From 9cbb9e5dffb55b456cb443d70d2b76b93b4f03a8 Mon Sep 17 00:00:00 2001 From: Mia Albert Date: Thu, 6 Aug 2026 08:12:36 -0400 Subject: [PATCH 2/4] gh-150693: Combine docs sections for external resources (#150694) --- Doc/tools/templates/indexcontent.html | 6 ++++++ Doc/tools/templates/indexsidebar.html | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html index 4982bcbfe3673c..4366da69d1b2d0 100644 --- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -82,10 +82,16 @@

{{ docstitle|e }}

{% trans %}Other resources:{% endtrans %}

diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html index 086f15662cf87b..5e7f03cd024ef7 100644 --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -6,12 +6,3 @@

{% trans %}Docs by version{% endtrans %}

{% include "_docs_by_version.html" without context %}
  • {% trans %}All versions{% endtrans %}
  • -

    {% trans %}Other resources{% endtrans %}

    - From 5965f08d702aadfc5ae51134c22261cefbc82da5 Mon Sep 17 00:00:00 2001 From: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com> Date: Thu, 6 Aug 2026 16:49:24 +0200 Subject: [PATCH 3/4] gh-109861: Fix a doctest in Lib/_pydecimal.py which was failing when running its doctests directly (GH-125479) Fix a doctest in ``Lib/_pydecimal.py`` which was failing when run directly on the module via the command: ./python.exe -m doctest Lib/_pydecimal.py Co-authored-by: Sergey B Kirpichev --- Lib/_pydecimal.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py index e0b32b7a5e2113..57d6143daea43a 100644 --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -1824,9 +1824,10 @@ def __round__(self, n=None): Decimal('123.46') >>> round(Decimal('123.456'), -2) Decimal('1E+2') - >>> round(Decimal('-Infinity'), 37) + >>> with localcontext(ExtendedContext): + ... round(Decimal('-Infinity'), 37) + ... round(Decimal('sNaN123'), 0) Decimal('NaN') - >>> round(Decimal('sNaN123'), 0) Decimal('NaN123') """ From c3aefdb9eff0734058376b96fc86d89b1a345d75 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 6 Aug 2026 18:09:22 +0300 Subject: [PATCH 4/4] gh-75876: Use functools.wraps() in test.support test decorators (GH-155262) bigmemtest(), bigaddrspacetest() and no_rerun() returned a wrapper named "wrapper", so a decorator applied on top of them could not identify the test. Co-authored-by: Claude Opus 5 (1M context) --- Lib/test/support/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 7898ef5e15b2c4..74d3794289bf69 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1293,6 +1293,7 @@ def bigmemtest(size, memuse, dry_run=True): test doesn't support dummy runs when -M is not specified. """ def decorator(f): + @functools.wraps(f) def wrapper(self): size = wrapper.size memuse = wrapper.memuse @@ -1345,6 +1346,7 @@ def internal(*args, **kwargs): def bigaddrspacetest(f): """Decorator for tests that fill the address space.""" + @functools.wraps(f) def wrapper(self): if max_memuse < MAX_Py_ssize_t: if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31: @@ -1450,6 +1452,7 @@ def no_rerun(reason): def deco(func): assert not isinstance(func, type), func _has_run = False + @functools.wraps(func) def wrapper(self): nonlocal _has_run if _has_run: