2018-10-31 23:15:58 -03:00
|
|
|
#ifndef Py_INTERNAL_LIFECYCLE_H
|
|
|
|
#define Py_INTERNAL_LIFECYCLE_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-04-17 18:02:26 -03:00
|
|
|
#ifndef Py_BUILD_CORE
|
|
|
|
# error "this header requires Py_BUILD_CORE define"
|
2018-10-31 23:15:58 -03:00
|
|
|
#endif
|
|
|
|
|
2021-03-11 18:35:45 -04:00
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
|
|
#include <signal.h>
|
|
|
|
#endif
|
|
|
|
|
2021-03-10 15:00:46 -04:00
|
|
|
#include "pycore_runtime.h" // _PyRuntimeState
|
|
|
|
|
2021-03-11 18:35:45 -04:00
|
|
|
#ifndef NSIG
|
|
|
|
# if defined(_NSIG)
|
|
|
|
# define NSIG _NSIG /* For BSD/SysV */
|
|
|
|
# elif defined(_SIGMAX)
|
|
|
|
# define NSIG (_SIGMAX + 1) /* For QNX */
|
|
|
|
# elif defined(SIGMAX)
|
|
|
|
# define NSIG (SIGMAX + 1) /* For djgpp */
|
|
|
|
# else
|
|
|
|
# define NSIG 64 /* Use a reasonable default value */
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2019-10-02 18:51:20 -03:00
|
|
|
/* Forward declarations */
|
2019-10-03 21:21:05 -03:00
|
|
|
struct _PyArgv;
|
|
|
|
struct pyruntimestate;
|
2019-04-24 12:24:01 -03:00
|
|
|
|
2019-02-16 16:57:40 -04:00
|
|
|
/* True if the main interpreter thread exited due to an unhandled
|
|
|
|
* KeyboardInterrupt exception, suggesting the user pressed ^C. */
|
|
|
|
PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt;
|
|
|
|
|
2019-05-02 12:54:20 -03:00
|
|
|
extern int _Py_SetFileSystemEncoding(
|
2018-10-31 23:15:58 -03:00
|
|
|
const char *encoding,
|
|
|
|
const char *errors);
|
2019-05-02 12:54:20 -03:00
|
|
|
extern void _Py_ClearFileSystemEncoding(void);
|
2019-06-19 19:05:23 -03:00
|
|
|
extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate);
|
2019-05-02 15:56:30 -03:00
|
|
|
#ifdef MS_WINDOWS
|
|
|
|
extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void);
|
|
|
|
#endif
|
2018-10-31 23:15:58 -03:00
|
|
|
|
|
|
|
PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void);
|
|
|
|
|
|
|
|
PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
|
|
|
|
|
2019-01-22 12:39:03 -04:00
|
|
|
/* Various one-time initializers */
|
|
|
|
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyStatus _PyUnicode_Init(PyInterpreterState *interp);
|
2021-04-02 10:28:13 -03:00
|
|
|
extern PyStatus _PyUnicode_InitTypes(void);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyStatus _PyBytes_Init(PyInterpreterState *interp);
|
2018-10-31 23:15:58 -03:00
|
|
|
extern int _PyStructSequence_Init(void);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern int _PyLong_Init(PyInterpreterState *interp);
|
2021-04-02 10:28:13 -03:00
|
|
|
extern int _PyLong_InitTypes(void);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyStatus _PyTuple_Init(PyInterpreterState *interp);
|
2019-05-27 11:39:22 -03:00
|
|
|
extern PyStatus _PyFaulthandler_Init(int enable);
|
2018-10-31 23:15:58 -03:00
|
|
|
extern int _PyTraceMalloc_Init(int enable);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyObject * _PyBuiltin_Init(PyInterpreterState *interp);
|
2019-05-27 11:39:22 -03:00
|
|
|
extern PyStatus _PySys_Create(
|
2019-06-19 19:05:23 -03:00
|
|
|
PyThreadState *tstate,
|
2019-01-23 10:04:40 -04:00
|
|
|
PyObject **sysmod_p);
|
2019-09-29 20:40:17 -03:00
|
|
|
extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
|
2019-08-23 14:03:08 -03:00
|
|
|
extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
|
2020-11-04 12:34:34 -04:00
|
|
|
extern int _PySys_UpdateConfig(PyThreadState *tstate);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyStatus _PyExc_Init(PyInterpreterState *interp);
|
2021-04-02 10:28:13 -03:00
|
|
|
extern PyStatus _PyErr_InitTypes(void);
|
2019-05-27 11:39:22 -03:00
|
|
|
extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod);
|
2021-04-02 10:28:13 -03:00
|
|
|
extern void _PyFloat_Init(void);
|
|
|
|
extern int _PyFloat_InitTypes(void);
|
2019-05-27 11:39:22 -03:00
|
|
|
extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
|
2018-10-31 23:15:58 -03:00
|
|
|
|
2019-05-27 11:39:22 -03:00
|
|
|
extern PyStatus _PyTypes_Init(void);
|
2020-01-30 04:02:14 -04:00
|
|
|
extern PyStatus _PyTypes_InitSlotDefs(void);
|
2019-06-18 21:54:39 -03:00
|
|
|
extern PyStatus _PyImportZip_Init(PyThreadState *tstate);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern PyStatus _PyGC_Init(PyInterpreterState *interp);
|
|
|
|
extern PyStatus _PyAtExit_Init(PyInterpreterState *interp);
|
2019-05-13 12:12:45 -03:00
|
|
|
|
2018-10-31 23:15:58 -03:00
|
|
|
|
2019-01-22 12:39:03 -04:00
|
|
|
/* Various internal finalizers */
|
|
|
|
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyFrame_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyDict_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyTuple_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyList_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyBytes_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyFloat_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PySlice_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyAsyncGen_Fini(PyInterpreterState *interp);
|
2019-08-26 19:12:32 -03:00
|
|
|
|
2020-11-17 11:22:23 -04:00
|
|
|
extern int _PySignal_Init(int install_signal_handlers);
|
|
|
|
extern void _PySignal_Fini(void);
|
2019-01-22 12:39:03 -04:00
|
|
|
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyExc_Fini(PyInterpreterState *interp);
|
2019-01-22 12:39:03 -04:00
|
|
|
extern void _PyImport_Fini(void);
|
|
|
|
extern void _PyImport_Fini2(void);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyGC_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyType_Fini(PyInterpreterState *interp);
|
2019-01-22 12:39:03 -04:00
|
|
|
extern void _Py_HashRandomization_Fini(void);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyUnicode_Fini(PyInterpreterState *interp);
|
|
|
|
extern void _PyUnicode_ClearInterned(PyInterpreterState *interp);
|
|
|
|
extern void _PyLong_Fini(PyInterpreterState *interp);
|
2018-10-31 23:15:58 -03:00
|
|
|
extern void _PyFaulthandler_Fini(void);
|
|
|
|
extern void _PyHash_Fini(void);
|
2019-09-18 09:39:20 -03:00
|
|
|
extern void _PyTraceMalloc_Fini(void);
|
2019-05-10 14:29:55 -03:00
|
|
|
extern void _PyWarnings_Fini(PyInterpreterState *interp);
|
2020-11-03 13:07:15 -04:00
|
|
|
extern void _PyAST_Fini(PyInterpreterState *interp);
|
2020-12-15 09:34:19 -04:00
|
|
|
extern void _PyAtExit_Fini(PyInterpreterState *interp);
|
2018-10-31 23:15:58 -03:00
|
|
|
|
2021-03-10 15:00:46 -04:00
|
|
|
extern PyStatus _PyGILState_Init(_PyRuntimeState *runtime);
|
|
|
|
extern PyStatus _PyGILState_SetTstate(PyThreadState *tstate);
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyGILState_Fini(PyInterpreterState *interp);
|
2018-10-31 23:15:58 -03:00
|
|
|
|
2021-02-19 10:10:45 -04:00
|
|
|
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(PyInterpreterState *interp);
|
2018-10-31 23:15:58 -03:00
|
|
|
|
2019-05-27 11:39:22 -03:00
|
|
|
PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv(
|
|
|
|
const PyPreConfig *src_config,
|
2019-10-03 21:21:05 -03:00
|
|
|
const struct _PyArgv *args);
|
2019-05-27 11:39:22 -03:00
|
|
|
PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
|
|
|
|
const PyConfig *config,
|
2019-10-03 21:21:05 -03:00
|
|
|
const struct _PyArgv *args);
|
2019-03-25 22:31:11 -03:00
|
|
|
|
2019-05-22 06:28:22 -03:00
|
|
|
|
2019-05-17 18:05:29 -03:00
|
|
|
PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
|
|
|
|
|
2019-05-22 06:28:22 -03:00
|
|
|
PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);
|
|
|
|
|
2019-05-24 12:01:38 -03:00
|
|
|
PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
|
2019-05-27 19:39:52 -03:00
|
|
|
PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception,
|
|
|
|
PyObject *value, PyObject *tb);
|
2019-05-24 12:01:38 -03:00
|
|
|
|
2020-03-17 22:26:04 -03:00
|
|
|
PyAPI_FUNC(void) _PyThreadState_DeleteCurrent(PyThreadState *tstate);
|
2019-09-05 13:06:49 -03:00
|
|
|
|
2021-02-19 10:10:45 -04:00
|
|
|
extern void _PyAtExit_Call(PyInterpreterState *interp);
|
2020-12-14 18:07:54 -04:00
|
|
|
|
2018-10-31 23:15:58 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_INTERNAL_LIFECYCLE_H */
|