@@ -147,35 +147,7 @@ Upgrade Operations
147147pythoncapi_compat.h functions
148148=============================
149149
150- Some functions are not available on PyPy.
151-
152- Borrow variant
153- --------------
154-
155- To ease migration of C extensions to the new C API, a variant is provided
156- to return borrowed references rather than strong references::
157-
158- // Similar to "Py_INCREF(ob); return ob;"
159- PyObject* _Py_StealRef(PyObject *ob);
160-
161- // Similar to "Py_XINCREF(ob); return ob;"
162- PyObject* _Py_XStealRef(PyObject *ob);
163-
164- // PyThreadState_GetFrame()
165- PyFrameObject* _PyThreadState_GetFrameBorrow(PyThreadState *tstate)
166-
167- // PyFrame_GetCode()
168- PyCodeObject* _PyFrame_GetCodeBorrow(PyFrameObject *frame)
169-
170- // PyFrame_GetBack()
171- PyFrameObject* _PyFrame_GetBackBorrow(PyFrameObject *frame)
172-
173- For example, ``tstate->frame `` can be replaced with
174- ``_PyThreadState_GetFrameBorrow(tstate) `` to avoid accessing directly
175- ``PyThreadState.frame `` member.
176-
177- These functions are only available in ``pythoncapi_compat.h `` and are not
178- part of the Python C API.
150+ Some functions related to frame objects are not available on PyPy.
179151
180152Python 3.10
181153-----------
@@ -209,13 +181,15 @@ PyFrameObject
209181::
210182
211183 PyCodeObject* PyFrame_GetCode(PyFrameObject *frame);
184+ // Not available on PyPy
212185 PyFrameObject* PyFrame_GetBack(PyFrameObject *frame);
213186
214187PyThreadState
215188^^^^^^^^^^^^^
216189
217190::
218191
192+ // Not available on PyPy
219193 PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate);
220194 PyInterpreterState* PyThreadState_GetInterpreter(PyThreadState *tstate);
221195 // Availability: Python 3.7
@@ -259,6 +233,34 @@ Python 3.4
259233
260234 Py_UNUSED(name)
261235
236+ Borrow variant
237+ --------------
238+
239+ To ease migration of C extensions to the new C API, a variant is provided
240+ to return borrowed references rather than strong references::
241+
242+ // Similar to "Py_INCREF(ob); return ob;"
243+ PyObject* _Py_StealRef(PyObject *ob);
244+
245+ // Similar to "Py_XINCREF(ob); return ob;"
246+ PyObject* _Py_XStealRef(PyObject *ob);
247+
248+ // PyThreadState_GetFrame(). Not available on PyPy.
249+ PyFrameObject* _PyThreadState_GetFrameBorrow(PyThreadState *tstate)
250+
251+ // PyFrame_GetCode()
252+ PyCodeObject* _PyFrame_GetCodeBorrow(PyFrameObject *frame)
253+
254+ // PyFrame_GetBack(). Not available on PyPy.
255+ PyFrameObject* _PyFrame_GetBackBorrow(PyFrameObject *frame)
256+
257+ For example, ``tstate->frame `` can be replaced with
258+ ``_PyThreadState_GetFrameBorrow(tstate) `` to avoid accessing directly
259+ ``PyThreadState.frame `` member.
260+
261+ These functions are only available in ``pythoncapi_compat.h `` and are not
262+ part of the Python C API.
263+
262264
263265Run tests
264266=========
0 commit comments