Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:20:55

0001 #ifndef Py_CPYTHON_PYLIFECYCLE_H
0002 #  error "this header file must not be included directly"
0003 #endif
0004 
0005 /* Py_FrozenMain is kept out of the Limited API until documented and present
0006    in all builds of Python */
0007 PyAPI_FUNC(int) Py_FrozenMain(int argc, char **argv);
0008 
0009 /* Only used by applications that embed the interpreter and need to
0010  * override the standard encoding determination mechanism
0011  */
0012 Py_DEPRECATED(3.11) PyAPI_FUNC(int) Py_SetStandardStreamEncoding(
0013     const char *encoding,
0014     const char *errors);
0015 
0016 /* PEP 432 Multi-phase initialization API (Private while provisional!) */
0017 
0018 PyAPI_FUNC(PyStatus) Py_PreInitialize(
0019     const PyPreConfig *src_config);
0020 PyAPI_FUNC(PyStatus) Py_PreInitializeFromBytesArgs(
0021     const PyPreConfig *src_config,
0022     Py_ssize_t argc,
0023     char **argv);
0024 PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs(
0025     const PyPreConfig *src_config,
0026     Py_ssize_t argc,
0027     wchar_t **argv);
0028 
0029 PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
0030 
0031 
0032 /* Initialization and finalization */
0033 
0034 PyAPI_FUNC(PyStatus) Py_InitializeFromConfig(
0035     const PyConfig *config);
0036 PyAPI_FUNC(PyStatus) _Py_InitializeMain(void);
0037 
0038 PyAPI_FUNC(int) Py_RunMain(void);
0039 
0040 
0041 PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
0042 
0043 /* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
0044 PyAPI_FUNC(void) _Py_RestoreSignals(void);
0045 
0046 PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
0047 PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename);
0048 
0049 Py_DEPRECATED(3.11) PyAPI_FUNC(void) _Py_SetProgramFullPath(const wchar_t *);
0050 
0051 PyAPI_FUNC(const char *) _Py_gitidentifier(void);
0052 PyAPI_FUNC(const char *) _Py_gitversion(void);
0053 
0054 PyAPI_FUNC(int) _Py_IsFinalizing(void);
0055 PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp);
0056 
0057 /* Random */
0058 PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
0059 PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
0060 
0061 /* Legacy locale support */
0062 PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn);
0063 PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn);
0064 PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
0065 
0066 /* --- PyInterpreterConfig ------------------------------------ */
0067 
0068 #define PyInterpreterConfig_DEFAULT_GIL (0)
0069 #define PyInterpreterConfig_SHARED_GIL (1)
0070 #define PyInterpreterConfig_OWN_GIL (2)
0071 
0072 typedef struct {
0073     // XXX "allow_object_sharing"?  "own_objects"?
0074     int use_main_obmalloc;
0075     int allow_fork;
0076     int allow_exec;
0077     int allow_threads;
0078     int allow_daemon_threads;
0079     int check_multi_interp_extensions;
0080     int gil;
0081 } PyInterpreterConfig;
0082 
0083 #define _PyInterpreterConfig_INIT \
0084     { \
0085         .use_main_obmalloc = 0, \
0086         .allow_fork = 0, \
0087         .allow_exec = 0, \
0088         .allow_threads = 1, \
0089         .allow_daemon_threads = 0, \
0090         .check_multi_interp_extensions = 1, \
0091         .gil = PyInterpreterConfig_OWN_GIL, \
0092     }
0093 
0094 #define _PyInterpreterConfig_LEGACY_INIT \
0095     { \
0096         .use_main_obmalloc = 1, \
0097         .allow_fork = 1, \
0098         .allow_exec = 1, \
0099         .allow_threads = 1, \
0100         .allow_daemon_threads = 1, \
0101         .check_multi_interp_extensions = 0, \
0102         .gil = PyInterpreterConfig_SHARED_GIL, \
0103     }
0104 
0105 PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
0106     PyThreadState **tstate_p,
0107     const PyInterpreterConfig *config);
0108 
0109 typedef void (*atexit_datacallbackfunc)(void *);
0110 PyAPI_FUNC(int) _Py_AtExit(
0111         PyInterpreterState *, atexit_datacallbackfunc, void *);