• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef Py_INTERNAL_LIFECYCLE_H
2 #define Py_INTERNAL_LIFECYCLE_H
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #ifndef Py_BUILD_CORE
8 #  error "this header requires Py_BUILD_CORE define"
9 #endif
10 
11 #include "pycore_initconfig.h"   /* _PyArgv */
12 #include "pycore_pystate.h"      /* _PyRuntimeState */
13 
14 /* True if the main interpreter thread exited due to an unhandled
15  * KeyboardInterrupt exception, suggesting the user pressed ^C. */
16 PyAPI_DATA(int) _Py_UnhandledKeyboardInterrupt;
17 
18 extern int _Py_SetFileSystemEncoding(
19     const char *encoding,
20     const char *errors);
21 extern void _Py_ClearFileSystemEncoding(void);
22 extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate);
23 #ifdef MS_WINDOWS
24 extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void);
25 #endif
26 
27 PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void);
28 
29 PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
30 
31 /* Various one-time initializers */
32 
33 extern PyStatus _PyUnicode_Init(void);
34 extern int _PyStructSequence_Init(void);
35 extern int _PyLong_Init(void);
36 extern PyStatus _PyFaulthandler_Init(int enable);
37 extern int _PyTraceMalloc_Init(int enable);
38 extern PyObject * _PyBuiltin_Init(void);
39 extern PyStatus _PySys_Create(
40     _PyRuntimeState *runtime,
41     PyInterpreterState *interp,
42     PyObject **sysmod_p);
43 extern PyStatus _PySys_SetPreliminaryStderr(PyObject *sysdict);
44 extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options);
45 extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config);
46 extern int _PySys_InitMain(
47     _PyRuntimeState *runtime,
48     PyInterpreterState *interp);
49 extern PyStatus _PyImport_Init(PyInterpreterState *interp);
50 extern PyStatus _PyExc_Init(void);
51 extern PyStatus _PyErr_Init(void);
52 extern PyStatus _PyBuiltins_AddExceptions(PyObject * bltinmod);
53 extern PyStatus _PyImportHooks_Init(void);
54 extern int _PyFloat_Init(void);
55 extern PyStatus _Py_HashRandomization_Init(const PyConfig *);
56 
57 extern PyStatus _PyTypes_Init(void);
58 extern PyStatus _PyImportZip_Init(PyInterpreterState *interp);
59 
60 
61 /* Various internal finalizers */
62 
63 extern void PyMethod_Fini(void);
64 extern void PyFrame_Fini(void);
65 extern void PyCFunction_Fini(void);
66 extern void PyDict_Fini(void);
67 extern void PyTuple_Fini(void);
68 extern void PyList_Fini(void);
69 extern void PySet_Fini(void);
70 extern void PyBytes_Fini(void);
71 extern void PyFloat_Fini(void);
72 extern void PyOS_FiniInterrupts(void);
73 extern void PySlice_Fini(void);
74 extern void PyAsyncGen_Fini(void);
75 
76 extern void _PyExc_Fini(void);
77 extern void _PyImport_Fini(void);
78 extern void _PyImport_Fini2(void);
79 extern void _PyGC_Fini(_PyRuntimeState *runtime);
80 extern void _PyType_Fini(void);
81 extern void _Py_HashRandomization_Fini(void);
82 extern void _PyUnicode_Fini(void);
83 extern void PyLong_Fini(void);
84 extern void _PyFaulthandler_Fini(void);
85 extern void _PyHash_Fini(void);
86 extern void _PyTraceMalloc_Fini(void);
87 extern void _PyWarnings_Fini(PyInterpreterState *interp);
88 
89 extern void _PyGILState_Init(
90     _PyRuntimeState *runtime,
91     PyInterpreterState *interp,
92     PyThreadState *tstate);
93 extern void _PyGILState_Fini(_PyRuntimeState *runtime);
94 
95 PyAPI_FUNC(void) _PyGC_DumpShutdownStats(_PyRuntimeState *runtime);
96 
97 PyAPI_FUNC(PyStatus) _Py_PreInitializeFromPyArgv(
98     const PyPreConfig *src_config,
99     const _PyArgv *args);
100 PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
101     const PyConfig *config,
102     const _PyArgv *args);
103 
104 
105 PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
106 
107 PyAPI_FUNC(PyObject*) _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable);
108 
109 PyAPI_FUNC(void) _PyErr_Print(PyThreadState *tstate);
110 PyAPI_FUNC(void) _PyErr_Display(PyObject *file, PyObject *exception,
111                                 PyObject *value, PyObject *tb);
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 #endif /* !Py_INTERNAL_LIFECYCLE_H */
117