#ifndef Py_INTERNAL_COMPILE_H
#define Py_INTERNAL_COMPILE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_BUILD_CORE
# error "this header requires Py_BUILD_CORE define"
#endif
struct _arena;
struct _mod;
PyAPI_FUNC(PyCodeObject*) _PyAST_Compile(
struct _mod *mod,
PyObject *filename,
PyCompilerFlags *flags,
int optimize,
struct _arena *arena);
static const _PyCompilerSrcLocation NO_LOCATION = {-1, -1, -1, -1};
extern int _PyAST_Optimize(
struct _mod *,
struct _arena *arena,
int optimize,
int ff_features);
typedef struct {
int h_label;
int h_startdepth;
int h_preserve_lasti;
} _PyCompile_ExceptHandlerInfo;
typedef struct {
int i_opcode;
int i_oparg;
_PyCompilerSrcLocation i_loc;
_PyCompile_ExceptHandlerInfo i_except_handler_info;
int i_target;
int i_offset;
} _PyCompile_Instruction;
typedef struct {
_PyCompile_Instruction *s_instrs;
int s_allocated;
int s_used;
int *s_labelmap;
int s_labelmap_size;
int s_next_free_label;
} _PyCompile_InstructionSequence;
typedef struct {
PyObject *u_name;
PyObject *u_qualname;
PyObject *u_consts;
PyObject *u_names;
PyObject *u_varnames;
PyObject *u_cellvars;
PyObject *u_freevars;
PyObject *u_fasthidden;
Py_ssize_t u_argcount;
Py_ssize_t u_posonlyargcount;
Py_ssize_t u_kwonlyargcount;
int u_firstlineno;
} _PyCompile_CodeUnitMetadata;
int _PyCompile_EnsureArrayLargeEnough(
int idx,
void **array,
int *alloc,
int default_alloc,
size_t item_size);
int _PyCompile_ConstCacheMergeOne(PyObject *const_cache, PyObject **obj);
PyAPI_FUNC(PyObject*) _PyCompile_CodeGen(
PyObject *ast,
PyObject *filename,
PyCompilerFlags *flags,
int optimize,
int compile_mode);
PyAPI_FUNC(PyObject*) _PyCompile_OptimizeCfg(
PyObject *instructions,
PyObject *consts,
int nlocals);
PyAPI_FUNC(PyCodeObject*)
_PyCompile_Assemble(_PyCompile_CodeUnitMetadata *umd, PyObject *filename,
PyObject *instructions);
#ifdef __cplusplus
}
#endif
#endif