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 Mark.Shannon, miss-islington, nedbat, petr.viktorin, scoder, vstinner
Date 2022-03-01.22:51:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646175086.28.0.154984761899.issue40421@roundup.psfhosted.org>
In-reply-to
Content
I searched for "\<_f" regex in Cython (0.29.x) branch. I found the following code getting or setting PyFrameObject fields.

== Set f_back ==

__Pyx_Coroutine_SendEx() at Utility/Coroutine.c:721:

    f->f_back = PyThreadState_GetFrame(tstate);

__Pyx_Coroutine_ResetFrameBackpointer() at Utility/Coroutine.c:775:

    Py_CLEAR(f->f_back);


== Set f_lineno ==

__Pyx_PyFrame_SetLineNumber() at Utility/ModuleSetupCode.c:543:

    #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)


__Pyx_PyFrame_SetLineNumber() is called by 3 functions:

* __Pyx_AddTraceback()
* __Pyx_call_line_trace_func()
* __Pyx_TraceSetupAndCall()

__Pyx_AddTraceback() pseudo-code:

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename)
{
    py_frame = PyFrame_New(..., py_code, ...);
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    ...
}



== f_localsplus ==

If the CYTHON_FAST_PYCALL macro is defined, sizeof(PyFrameObject) is used to get the f_localsplus member.

__Pyx_PyFrame_GetLocalsplus() at Utility/ObjectHandling.c:1996:
---
// Initialised by module init code.
static size_t __pyx_pyframe_localsplus_offset = 0;

#include "frameobject.h"

#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))
---

== Get f_trace ==

__Pyx_TraceLine() at Utility/Profile.c:238:

    if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace)


== Set f_frame ==

__Pyx_TraceSetupAndCall() at Utility/Profile.c:299:

    (*frame)->f_tstate = tstate;
History
Date User Action Args
2022-03-01 22:51:26vstinnersetrecipients: + vstinner, scoder, nedbat, petr.viktorin, Mark.Shannon, miss-islington
2022-03-01 22:51:26vstinnersetmessageid: <1646175086.28.0.154984761899.issue40421@roundup.psfhosted.org>
2022-03-01 22:51:26vstinnerlinkissue40421 messages
2022-03-01 22:51:26vstinnercreate