1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use crate::ffi3::code::{PyCodeObject, CO_MAXBLOCKS};
use crate::ffi3::object::*;
use crate::ffi3::pystate::PyThreadState;
use std::os::raw::{c_char, c_int};
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PyTryBlock {
    pub b_type: c_int,
    pub b_handler: c_int,
    pub b_level: c_int,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct PyFrameObject {
    pub ob_base: PyVarObject,
    pub f_back: *mut PyFrameObject,       
    pub f_code: *mut PyCodeObject,        
    pub f_builtins: *mut PyObject,        
    pub f_globals: *mut PyObject,         
    pub f_locals: *mut PyObject,          
    pub f_valuestack: *mut *mut PyObject, 
    
    pub f_stacktop: *mut *mut PyObject,
    pub f_trace: *mut PyObject, 
    pub f_exc_type: *mut PyObject,
    pub f_exc_value: *mut PyObject,
    pub f_exc_traceback: *mut PyObject,
    pub f_gen: *mut PyObject,
    pub f_lasti: c_int, 
    
    pub f_lineno: c_int,                          
    pub f_iblock: c_int,                          
    pub f_executing: c_char,                      
    pub f_blockstack: [PyTryBlock; CO_MAXBLOCKS], 
    pub f_localsplus: [*mut PyObject; 1],         
}
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
    pub static mut PyFrame_Type: PyTypeObject;
}
#[inline]
pub unsafe fn PyFrame_Check(op: *mut PyObject) -> c_int {
    (Py_TYPE(op) == &mut PyFrame_Type) as c_int
}
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
    pub fn PyFrame_New(
        tstate: *mut PyThreadState,
        code: *mut PyCodeObject,
        globals: *mut PyObject,
        locals: *mut PyObject,
    ) -> *mut PyFrameObject;
    pub fn PyFrame_BlockSetup(
        f: *mut PyFrameObject,
        _type: c_int,
        handler: c_int,
        level: c_int,
    ) -> ();
    pub fn PyFrame_BlockPop(f: *mut PyFrameObject) -> *mut PyTryBlock;
    pub fn PyFrame_LocalsToFast(f: *mut PyFrameObject, clear: c_int) -> ();
    pub fn PyFrame_FastToLocalsWithError(f: *mut PyFrameObject) -> c_int;
    pub fn PyFrame_FastToLocals(f: *mut PyFrameObject) -> ();
    pub fn PyFrame_ClearFreeList() -> c_int;
    pub fn PyFrame_GetLineNumber(f: *mut PyFrameObject) -> c_int;
}