Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
pylifecycle.h90 linesDownload Raw Back to cpython
1#ifndef Py_CPYTHON_PYLIFECYCLE_H2#  error "this header file must not be included directly"3#endif4 5/* Py_FrozenMain is kept out of the Limited API until documented and present6   in all builds of Python */7PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);8 9/* PEP 432 Multi-phase initialization API (Private while provisional!) */10 11PyAPI_FUNC(PyStatus) Py_PreInitialize(12    const PyPreConfig *src_config);13PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs(14    const PyPreConfig *src_config,15    Py_ssize_t argc,16    char **argv);17PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs(18    const PyPreConfig *src_config,19    Py_ssize_t argc,20    wchar_t **argv);21 22 23/* Initialization and finalization */24 25PyAPI_FUNC(PyStatus) Py_InitializeFromConfig(26    const PyConfig *config);27 28PyAPI_FUNC(int) Py_RunMain(void);29 30 31PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);32 33PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);34 35/* --- PyInterpreterConfig ------------------------------------ */36 37#define PyInterpreterConfig_DEFAULT_GIL (0)38#define PyInterpreterConfig_SHARED_GIL (1)39#define PyInterpreterConfig_OWN_GIL (2)40 41typedef struct {42    // XXX "allow_object_sharing"?  "own_objects"?43    int use_main_obmalloc;44    int allow_fork;45    int allow_exec;46    int allow_threads;47    int allow_daemon_threads;48    int check_multi_interp_extensions;49    int gil;50} PyInterpreterConfig;51 52#define _PyInterpreterConfig_INIT \53    { \54        .use_main_obmalloc = 0, \55        .allow_fork = 0, \56        .allow_exec = 0, \57        .allow_threads = 1, \58        .allow_daemon_threads = 0, \59        .check_multi_interp_extensions = 1, \60        .gil = PyInterpreterConfig_OWN_GIL, \61    }62 63// gh-117649: The free-threaded build does not currently support single-phase64// init extensions in subinterpreters. For now, we ensure that65// `check_multi_interp_extensions` is always `1`, even in the legacy config.66#ifdef Py_GIL_DISABLED67#  define _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS 168#else69#  define _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS 070#endif71 72#define _PyInterpreterConfig_LEGACY_INIT \73    { \74        .use_main_obmalloc = 1, \75        .allow_fork = 1, \76        .allow_exec = 1, \77        .allow_threads = 1, \78        .allow_daemon_threads = 1, \79        .check_multi_interp_extensions = _PyInterpreterConfig_LEGACY_CHECK_MULTI_INTERP_EXTENSIONS, \80        .gil = PyInterpreterConfig_SHARED_GIL, \81    }82 83PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(84    PyThreadState **tstate_p,85    const PyInterpreterConfig *config);86 87typedef void (*atexit_datacallbackfunc)(void *);88PyAPI_FUNC(int) PyUnstable_AtExit(89        PyInterpreterState *, atexit_datacallbackfunc, void *);90 
codekingpro/portable-devtools · Team Ai