homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2020年04月28日.17:45:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588095957.63.0.60555205957.issue40421@roundup.psfhosted.org>
In-reply-to
Content
I looked how Cython uses PyFrameObject:
* read f_lasti
* read/write f_back
* write f_lineno
* read f_localsplus
* read/write f_trace
Details:
* Cython/Debugger/libpython.py: code using the Python API of gdb to read PyFrameObject.f_lasti. It it used to compute the line number of a frame. The python_step() function puts a watch point on "f->f_lasti".
* Cython/Utility/Coroutine.c: set PyFrameObject.f_back using "f->f_back = tstate->frame;" and "Py_CLEAR(f->f_back);".
* Cython/Utility/ModuleSetupCode.c, __Pyx_PyFrame_SetLineNumber(): set PyFrameObject.f_lineno member. The limited C API flavor of this function does nothing, since this member cannot be set in the limited C API.
* Cython/Utility/ObjectHandling.c, __Pyx_PyFrame_GetLocalsplus(): complex implementation to access PyFrameObject.f_localsplus:
 // Initialised by module init code.
 static size_t __pyx_pyframe_localsplus_offset = 0;
 #include "frameobject.h"
 // This is the long runtime version of
 // #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
 // offsetof(PyFrameObject, f_localsplus) differs between regular C-Python and Stackless Python.
 // Therefore the offset is computed at run time from PyFrame_type.tp_basicsize. That is feasible,
 // because f_localsplus is the last field of PyFrameObject (checked by Py_BUILD_ASSERT_EXPR below).
 #define __Pxy_PyFrame_Initialize_Offsets() \
 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)), \
 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
 #define __Pyx_PyFrame_GetLocalsplus(frame) \
 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
* Cython/Utility/Profile.c, __Pyx_TraceLine(): read PyFrameObject.f_trace.
* Cython/Utility/Profile.c, __Pyx_TraceSetupAndCall(): set PyFrameObject.f_trace.
History
Date User Action Args
2020年04月28日 17:45:57vstinnersetrecipients: + vstinner
2020年04月28日 17:45:57vstinnersetmessageid: <1588095957.63.0.60555205957.issue40421@roundup.psfhosted.org>
2020年04月28日 17:45:57vstinnerlinkissue40421 messages
2020年04月28日 17:45:57vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /