Skip to content

Commit fe3a123

Browse files
authored
gh-152105: Remove PyUnstable_ExecutableKinds and related macros (GH-155244)
1 parent 297eb1b commit fe3a123

6 files changed

Lines changed: 22 additions & 54 deletions

File tree

Doc/c-api/frame.rst

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -243,41 +243,3 @@ Unless using :pep:`523`, you will not need this.
243243
Return the currently executing line number, or -1 if there is no line number.
244244
245245
.. versionadded:: 3.12
246-
247-
248-
.. c:var:: const PyTypeObject *PyUnstable_ExecutableKinds
249-
250-
An array of executable kinds (executor types) for frames, used for internal
251-
debugging and tracing.
252-
253-
Tools like debuggers and profilers can use this to identify the type of execution
254-
context associated with a frame (such as to filter out internal frames).
255-
The entries are indexed by the following constants:
256-
257-
.. list-table::
258-
:header-rows: 1
259-
:widths: auto
260-
261-
* - Constant
262-
- Description
263-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP
264-
- The frame is internal (For example: inlined) and should be skipped by tools.
265-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION
266-
- The frame corresponds to a standard Python function.
267-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION
268-
- The frame corresponds to a function defined in native code.
269-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
270-
- The frame corresponds to a method on a class instance.
271-
272-
Note that reading the executable kind from a frame is currently only
273-
possible with undocumented internal APIs.
274-
275-
.. versionadded:: 3.13
276-
277-
278-
.. c:macro:: PyUnstable_EXECUTABLE_KINDS
279-
280-
The number of entries in :c:data:`PyUnstable_ExecutableKinds`.
281-
282-
.. versionadded:: 3.13
283-

Doc/tools/removed-ids.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ using/configure.html: cmdoption-with-system-libmpdec
2323
library/symtable.html: symtable.Class.get_methods
2424
library/sys.html: sys._enablelegacywindowsfsencoding
2525
c-api/import.html: c.PyImport_LazyImportsMode.PyImport_LAZY_NONE
26+
c-api/frame.html: c.PyUnstable_EXECUTABLE_KINDS
27+
c-api/frame.html: c.PyUnstable_ExecutableKinds
28+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION
29+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
30+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_PY_FUNCTION
31+
c-api/frame.html: c.PyUnstable_ExecutableKinds.PyUnstable_EXECUTABLE_KIND_SKIP
32+
2633

2734
## Old names for grammar tokens
2835
reference/expressions.html: grammar-token-python-grammar-comp_for

Doc/whatsnew/3.16.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,3 +872,12 @@ Deprecated C APIs
872872

873873
Removed C APIs
874874
--------------
875+
876+
* The :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros
877+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`,
878+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`,
879+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION`,
880+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR` and
881+
:c:macro:`!PyUnstable_EXECUTABLE_KINDS`, were removed.
882+
883+
(Contributed by Peters Bierma and Viktorin in :gh:`152105`.)

Include/cpython/pyframe.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,3 @@ PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLasti(struct _PyInterpreterFrame
3535
/* Returns the currently executing line number, or -1 if there is no line number.
3636
* Does not raise an exception. */
3737
PyAPI_FUNC(int) PyUnstable_InterpreterFrame_GetLine(struct _PyInterpreterFrame *frame);
38-
39-
#define PyUnstable_EXECUTABLE_KIND_SKIP 0
40-
#define PyUnstable_EXECUTABLE_KIND_PY_FUNCTION 1
41-
#define PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION 3
42-
#define PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR 4
43-
#define PyUnstable_EXECUTABLE_KINDS 5
44-
45-
PyAPI_DATA(const PyTypeObject *) const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1];
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Remove the :c:var:`!PyUnstable_ExecutableKinds` array, as well as the macros
2+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_SKIP`,
3+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_PY_FUNCTION`,
4+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION`,
5+
:c:macro:`!PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR` and
6+
:c:macro:`!PyUnstable_EXECUTABLE_KINDS`, from the C API.

Python/frame.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,3 @@ PyUnstable_InterpreterFrame_GetLine(_PyInterpreterFrame *frame)
149149
int addr = _PyInterpreterFrame_LASTI(frame) * sizeof(_Py_CODEUNIT);
150150
return PyCode_Addr2Line(_PyFrame_GetCode(frame), addr);
151151
}
152-
153-
const PyTypeObject *const PyUnstable_ExecutableKinds[PyUnstable_EXECUTABLE_KINDS+1] = {
154-
[PyUnstable_EXECUTABLE_KIND_SKIP] = &_PyNone_Type,
155-
[PyUnstable_EXECUTABLE_KIND_PY_FUNCTION] = &PyCode_Type,
156-
[PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION] = &PyMethod_Type,
157-
[PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR] = &PyMethodDescr_Type,
158-
[PyUnstable_EXECUTABLE_KINDS] = NULL,
159-
};

0 commit comments

Comments
 (0)