|
|
#ifndef Py_INTERNAL_INTERP_H |
|
|
#define Py_INTERNAL_INTERP_H |
|
|
#ifdef __cplusplus |
|
|
extern "C" { |
|
|
#endif |
|
|
|
|
|
#ifndef Py_BUILD_CORE |
|
|
# error "this header requires Py_BUILD_CORE define" |
|
|
#endif |
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
|
#include "pycore_atomic.h" |
|
|
#include "pycore_ast_state.h" |
|
|
#include "pycore_code.h" |
|
|
#include "pycore_context.h" |
|
|
#include "pycore_dict.h" |
|
|
#include "pycore_exceptions.h" |
|
|
#include "pycore_floatobject.h" |
|
|
#include "pycore_genobject.h" |
|
|
#include "pycore_gil.h" |
|
|
#include "pycore_gc.h" |
|
|
#include "pycore_list.h" |
|
|
#include "pycore_tuple.h" |
|
|
#include "pycore_typeobject.h" |
|
|
#include "pycore_unicodeobject.h" |
|
|
#include "pycore_warnings.h" |
|
|
|
|
|
struct _pending_calls { |
|
|
PyThread_type_lock lock; |
|
|
|
|
|
_Py_atomic_int calls_to_do; |
|
|
|
|
|
|
|
|
|
|
|
int async_exc; |
|
|
#define NPENDINGCALLS 32 |
|
|
struct { |
|
|
int (*func)(void *); |
|
|
void *arg; |
|
|
} calls[NPENDINGCALLS]; |
|
|
int first; |
|
|
int last; |
|
|
}; |
|
|
|
|
|
struct _ceval_state { |
|
|
int recursion_limit; |
|
|
|
|
|
|
|
|
_Py_atomic_int eval_breaker; |
|
|
|
|
|
_Py_atomic_int gil_drop_request; |
|
|
struct _pending_calls pending; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
PyObject *func; |
|
|
PyObject *args; |
|
|
PyObject *kwargs; |
|
|
} atexit_callback; |
|
|
|
|
|
struct atexit_state { |
|
|
atexit_callback **callbacks; |
|
|
int ncallbacks; |
|
|
int callback_len; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct _is { |
|
|
|
|
|
PyInterpreterState *next; |
|
|
|
|
|
struct pythreads { |
|
|
uint64_t next_unique_id; |
|
|
|
|
|
PyThreadState *head; |
|
|
|
|
|
long count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t stacksize; |
|
|
} threads; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct pyruntimestate *runtime; |
|
|
|
|
|
int64_t id; |
|
|
int64_t id_refcount; |
|
|
int requires_idref; |
|
|
PyThread_type_lock id_mutex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int _initialized; |
|
|
int finalizing; |
|
|
|
|
|
|
|
|
bool _static; |
|
|
|
|
|
struct _ceval_state ceval; |
|
|
struct _gc_runtime_state gc; |
|
|
|
|
|
|
|
|
PyObject *modules; |
|
|
PyObject *modules_by_index; |
|
|
|
|
|
PyObject *sysdict; |
|
|
|
|
|
PyObject *builtins; |
|
|
|
|
|
PyObject *importlib; |
|
|
|
|
|
|
|
|
int override_frozen_modules; |
|
|
|
|
|
PyObject *codec_search_path; |
|
|
PyObject *codec_search_cache; |
|
|
PyObject *codec_error_registry; |
|
|
int codecs_initialized; |
|
|
|
|
|
PyConfig config; |
|
|
#ifdef HAVE_DLOPEN |
|
|
int dlopenflags; |
|
|
#endif |
|
|
|
|
|
PyObject *dict; |
|
|
|
|
|
PyObject *builtins_copy; |
|
|
PyObject *import_func; |
|
|
|
|
|
_PyFrameEvalFunction eval_frame; |
|
|
|
|
|
Py_ssize_t co_extra_user_count; |
|
|
freefunc co_extra_freefuncs[MAX_CO_EXTRA_USERS]; |
|
|
|
|
|
#ifdef HAVE_FORK |
|
|
PyObject *before_forkers; |
|
|
PyObject *after_forkers_parent; |
|
|
PyObject *after_forkers_child; |
|
|
#endif |
|
|
|
|
|
struct _warnings_runtime_state warnings; |
|
|
struct atexit_state atexit; |
|
|
|
|
|
PyObject *audit_hooks; |
|
|
|
|
|
struct _Py_unicode_state unicode; |
|
|
struct _Py_float_state float_state; |
|
|
|
|
|
|
|
|
PySliceObject *slice_cache; |
|
|
|
|
|
struct _Py_tuple_state tuple; |
|
|
struct _Py_list_state list; |
|
|
struct _Py_dict_state dict_state; |
|
|
struct _Py_async_gen_state async_gen; |
|
|
struct _Py_context_state context; |
|
|
struct _Py_exc_state exc_state; |
|
|
|
|
|
struct ast_state ast; |
|
|
struct type_cache type_cache; |
|
|
struct callable_cache callable_cache; |
|
|
|
|
|
int int_max_str_digits; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyThreadState _initial_thread; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern void _PyInterpreterState_ClearModules(PyInterpreterState *interp); |
|
|
extern void _PyInterpreterState_Clear(PyThreadState *tstate); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct _xidregitem; |
|
|
|
|
|
struct _xidregitem { |
|
|
PyTypeObject *cls; |
|
|
crossinterpdatafunc getdata; |
|
|
struct _xidregitem *next; |
|
|
}; |
|
|
|
|
|
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_LookUpID(int64_t); |
|
|
|
|
|
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *); |
|
|
PyAPI_FUNC(int) _PyInterpreterState_IDIncref(PyInterpreterState *); |
|
|
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *); |
|
|
|
|
|
#ifdef __cplusplus |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
|