2018-11-01 03:15:58 +01:00
|
|
|
#ifndef Py_INTERNAL_LIFECYCLE_H
|
|
|
|
#define Py_INTERNAL_LIFECYCLE_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-04-17 23:02:26 +02:00
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
2018-11-01 03:15:58 +01:00
|
|
|
#endif
|
|
|
|
|
2021-03-10 20:00:46 +01:00
|
|
|
#include "pycore_runtime.h" // _PyRuntimeState
|
|
|
|
|
2019-10-02 23:51:20 +02:00
|
|
|
/* Forward declarations */
|
2019-10-04 02:21:05 +02:00
|
|
|
struct _PyArgv;
|
|
|
|
struct pyruntimestate;
|
2019-04-24 17:24:01 +02:00
|
|
|
|
2019-05-02 11:54:20 -04:00
|
|
|
extern int _Py_SetFileSystemEncoding(
|
2018-11-01 03:15:58 +01:00
|
|
|
const char *encoding,
|
|
|
|
const char *errors);
|
2019-05-02 11:54:20 -04:00
|
|
|
extern void _Py_ClearFileSystemEncoding(void);
|
2019-06-20 00:05:23 +02:00
|
|
|
extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate);
|
2019-05-02 14:56:30 -04:00
|
|
|
#ifdef MS_WINDOWS
|
|
|
|
extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void);
|
|
|
|
#endif
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern int _Py_IsLocaleCoercionTarget(const char *ctype_loc);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2019-01-22 17:39:03 +01:00
|
|
|
/* Various one-time initializers */
|
|
|
|
|
2022-11-15 09:45:11 -07:00
|
|
|
extern void _Py_InitVersion(void);
|
2019-05-27 16:39:22 +02:00
|
|
|
extern PyStatus _PyFaulthandler_Init(int enable);
|
2021-02-19 15:10:45 +01:00
|
|
|
extern PyObject * _PyBuiltin_Init(PyInterpreterState *interp);
|
2019-05-27 16:39:22 +02:00
|
|
|
extern PyStatus _PySys_Create(
|
2019-06-20 00:05:23 +02:00
|
|
|
PyThreadState *tstate,
|
2019-01-23 15:04:40 +01:00
|
|
|
PyObject **sysmod_p);
|
2019-09-30 01:40:17 +02:00
|
|
|
extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
|
2019-08-23 18:03:08 +01:00
|
|
|
extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
|
2020-11-04 17:34:34 +01:00
|
|
|
extern int _PySys_UpdateConfig(PyThreadState *tstate);
|
2023-05-01 19:36:00 -06:00
|
|
|
extern void _PySys_FiniTypes(PyInterpreterState *interp);
|
2022-01-22 21:48:56 +01:00
|
|
|
extern int _PyBuiltins_AddExceptions(PyObject * bltinmod);
|
2019-05-27 16:39:22 +02:00
|
|
|
extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2022-12-08 16:46:09 -07:00
|
|
|
extern PyStatus _PyTime_Init(void);
|
2021-02-19 15:10:45 +01:00
|
|
|
extern PyStatus _PyGC_Init(PyInterpreterState *interp);
|
|
|
|
extern PyStatus _PyAtExit_Init(PyInterpreterState *interp);
|
2022-02-26 22:05:03 +05:30
|
|
|
extern int _Py_Deepfreeze_Init(void);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2019-01-22 17:39:03 +01:00
|
|
|
/* Various internal finalizers */
|
|
|
|
|
2020-11-17 16:22:23 +01:00
|
|
|
extern int _PySignal_Init(int install_signal_handlers);
|
|
|
|
extern void _PySignal_Fini(void);
|
2019-01-22 17:39:03 +01:00
|
|
|
|
2021-02-19 15:10:45 +01:00
|
|
|
extern void _PyGC_Fini(PyInterpreterState *interp);
|
2019-01-22 17:39:03 +01:00
|
|
|
extern void _Py_HashRandomization_Fini(void);
|
2018-11-01 03:15:58 +01:00
|
|
|
extern void _PyFaulthandler_Fini(void);
|
|
|
|
extern void _PyHash_Fini(void);
|
2019-09-18 14:39:20 +02:00
|
|
|
extern void _PyTraceMalloc_Fini(void);
|
2019-05-10 13:29:55 -04:00
|
|
|
extern void _PyWarnings_Fini(PyInterpreterState *interp);
|
2020-11-03 18:07:15 +01:00
|
|
|
extern void _PyAST_Fini(PyInterpreterState *interp);
|
2020-12-15 14:34:19 +01:00
|
|
|
extern void _PyAtExit_Fini(PyInterpreterState *interp);
|
2022-01-21 01:42:25 +01:00
|
|
|
extern void _PyThread_FiniType(PyInterpreterState *interp);
|
2022-01-27 18:33:47 +05:30
|
|
|
extern void _Py_Deepfreeze_Fini(void);
|
2022-02-25 16:19:30 +01:00
|
|
|
extern void _PyArg_Fini(void);
|
2023-04-24 17:23:57 -06:00
|
|
|
extern void _Py_FinalizeAllocatedBlocks(_PyRuntimeState *);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2023-01-19 16:04:14 -07:00
|
|
|
extern PyStatus _PyGILState_Init(PyInterpreterState *interp);
|
2021-03-10 20:00:46 +01:00
|
|
|
extern PyStatus _PyGILState_SetTstate(PyThreadState *tstate);
|
2021-02-19 15:10:45 +01:00
|
|
|
extern void _PyGILState_Fini(PyInterpreterState *interp);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern void _PyGC_DumpShutdownStats(PyInterpreterState *interp);
|
2018-11-01 03:15:58 +01:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern PyStatus _Py_PreInitializeFromPyArgv(
|
2019-05-27 16:39:22 +02:00
|
|
|
const PyPreConfig *src_config,
|
2019-10-04 02:21:05 +02:00
|
|
|
const struct _PyArgv *args);
|
2023-07-04 11:41:43 +02:00
|
|
|
extern PyStatus _Py_PreInitializeFromConfig(
|
2019-05-27 16:39:22 +02:00
|
|
|
const PyConfig *config,
|
2019-10-04 02:21:05 +02:00
|
|
|
const struct _PyArgv *args);
|
2019-03-26 02:31:11 +01:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern wchar_t * _Py_GetStdlibDir(void);
|
2019-05-22 11:28:22 +02:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern int _Py_HandleSystemExit(int *exitcode_p);
|
2019-05-17 23:05:29 +02:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern PyObject* _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);
|
2019-05-22 11:28:22 +02:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern void _PyErr_Print(PyThreadState *tstate);
|
|
|
|
extern void _PyErr_Display(PyObject *file, PyObject *exception,
|
2019-05-28 00:39:52 +02:00
|
|
|
PyObject *value, PyObject *tb);
|
2023-07-04 11:41:43 +02:00
|
|
|
extern void _PyErr_DisplayException(PyObject *file, PyObject *exc);
|
2019-05-24 17:01:38 +02:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern void _PyThreadState_DeleteCurrent(PyThreadState *tstate);
|
2019-09-05 13:06:49 -03:00
|
|
|
|
2021-02-19 15:10:45 +01:00
|
|
|
extern void _PyAtExit_Call(PyInterpreterState *interp);
|
2020-12-14 23:07:54 +01:00
|
|
|
|
2023-07-04 11:41:43 +02:00
|
|
|
extern int _Py_IsCoreInitialized(void);
|
|
|
|
|
|
|
|
extern int _Py_FdIsInteractive(FILE *fp, PyObject *filename);
|
|
|
|
|
|
|
|
extern const char* _Py_gitidentifier(void);
|
|
|
|
extern const char* _Py_gitversion(void);
|
|
|
|
|
|
|
|
extern int _Py_IsFinalizing(void);
|
|
|
|
PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp);
|
|
|
|
|
|
|
|
/* Random */
|
|
|
|
extern int _PyOS_URandom(void *buffer, Py_ssize_t size);
|
|
|
|
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
|
|
|
|
|
|
|
|
/* Legacy locale support */
|
|
|
|
extern int _Py_CoerceLegacyLocale(int warn);
|
|
|
|
extern int _Py_LegacyLocaleDetected(int warn);
|
|
|
|
PyAPI_FUNC(char*) _Py_SetLocaleFromEnv(int category);
|
|
|
|
|
2018-11-01 03:15:58 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_INTERNAL_LIFECYCLE_H */
|