mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
gh-95756: Lazily created cached co_* attrs (GH-97791)
This commit is contained in:
parent
f871e9a7bb
commit
b399115ef1
5 changed files with 82 additions and 14 deletions
|
|
@ -32,6 +32,13 @@ typedef uint16_t _Py_CODEUNIT;
|
|||
#define _Py_SET_OPCODE(word, opcode) \
|
||||
do { ((unsigned char *)&(word))[0] = (opcode); } while (0)
|
||||
|
||||
typedef struct {
|
||||
PyObject *_co_code;
|
||||
PyObject *_co_varnames;
|
||||
PyObject *_co_cellvars;
|
||||
PyObject *_co_freevars;
|
||||
} _PyCoCached;
|
||||
|
||||
// To avoid repeating ourselves in deepfreeze.py, all PyCodeObject members are
|
||||
// defined in this macro:
|
||||
#define _PyCode_DEF(SIZE) { \
|
||||
|
|
@ -90,7 +97,7 @@ typedef uint16_t _Py_CODEUNIT;
|
|||
PyObject *co_qualname; /* unicode (qualname, for reference) */ \
|
||||
PyObject *co_linetable; /* bytes object that holds location info */ \
|
||||
PyObject *co_weakreflist; /* to support weakrefs to code objects */ \
|
||||
PyObject *_co_code; /* cached co_code object/attribute */ \
|
||||
_PyCoCached *_co_cached; /* cached co_* attributes */ \
|
||||
int _co_firsttraceable; /* index of first traceable instruction */ \
|
||||
char *_co_linearray; /* array of line offsets */ \
|
||||
/* Scratch space for extra data relating to the code object. \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue