FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-152105: Remove docs snippet that uses internal C API by encukou · Pull Request #155122 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
25 changes: 2 additions & 23 deletions Doc/c-api/frame.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading

Back | FazBrowse Home | New Git URL