]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-152105: Remove PyUnstable_ExecutableKinds and related macros (GH-155244)
authorPetr Viktorin <encukou@gmail.com>
Thu, 6 Aug 2026 11:33:36 +0000 (13:33 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Aug 2026 11:33:36 +0000 (13:33 +0200)
Doc/c-api/frame.rst
Doc/tools/removed-ids.txt
Doc/whatsnew/3.16.rst
Include/cpython/pyframe.h
Misc/NEWS.d/next/C_API/2026-07-30-16-58-36.gh-issue-152105.1Jz1YH.rst [new file with mode: 0644]
Python/frame.c

index 70a610cea82d06a8df3a57dfcfcc569232e015b8..4159ff6e5965fbd8d783c040f78b9e9921ac02b1 100644 (file)
@@ -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
-
index 7796d15f4d2735f6e035ecabc1e845c7bab1a3c7..3801e6d31199d69a79ba659d972fd09e14717a66 100644 (file)
@@ -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
index 90ab6758a264cd8d70c049d0fa4b147bdb68311e..210bcafe65f5e9cbdbe37245cc940e2956b37af9 100644 (file)
@@ -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`.)
index 51529763923ec3a48662219f08928b6b79ddd5fb..24a947de1ede1e12eef106b664a296cf0eedb857 100644 (file)
@@ -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 (file)
index 0000000..5440389
--- /dev/null
@@ -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.
index ff81eb0b3020c788617994cbfc93a5bc2dae68ea..ba8222417d208c2a4c8131121b46c5e5ba34a697 100644 (file)
@@ -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,
-};