https://github.com/python/cpython/commit/c5d49463f1a41f0812902f3834cb2aad0adfd0a1
commit: c5d49463f1a41f0812902f3834cb2aad0adfd0a1
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-08-05T14:50:47+02:00
summary:

gh-152105: Remove docs snippet that uses internal C API (GH-155122)

Follow-up to GH-143490.

`_PyInterpreterFrame.f_executable` and `PyStackRef_AsPyObjectBorrow` are 
undocumented and only available in the internal API.
Docs should not suggest using them, even if `PyUnstable_ExecutableKinds` is 
unusable without them.

Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Doc/c-api/frame.rst

diff --git a/Doc/c-api/frame.rst b/Doc/c-api/frame.rst
index a04ef4e422949b9..70a610cea82d06a 100644
--- a/Doc/c-api/frame.rst
+++ b/Doc/c-api/frame.rst
@@ -269,29 +269,8 @@ Unless using :pep:`523`, you will not need this.
       * - .. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
         - The frame corresponds to a method on a class instance.
 
-   However, Python's C API lacks a function to read the executable kind from
-   a frame. Instead, use this recipe:
-
-   .. code-block:: c
-
-      int
-      get_executable_kind(PyFrameObject *frame)
-      {
-         _PyInterpreterFrame *f = frame->f_frame;
-         PyObject *exec = PyStackRef_AsPyObjectBorrow(f->f_executable);
-
-         if (PyCode_Check(exec)) {
-            return PyUnstable_EXECUTABLE_KIND_PY_FUNCTION;
-         }
-         if (PyMethod_Check(exec)) {
-            return PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION;
-         }
-         if (Py_IS_TYPE(exec, &PyMethodDescr_Type)) {
-            return PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR;
-         }
-
-         return PyUnstable_EXECUTABLE_KIND_SKIP;
-      }
+   Note that reading the executable kind from a frame is currently only
+   possible with undocumented internal APIs.
 
    .. versionadded:: 3.13
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to