STINNER Victor <vstin...@python.org> added the comment:

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;

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40421>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to