| 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_typedefs.h" // _PyRuntimeState |
| 12 |
|
| 13 |
/* Forward declarations */ |
| 14 |
struct _PyArgv; |
| 15 |
|
| 16 |
extern int _Py_SetFileSystemEncoding( |
| 17 |
const char *encoding, |
| 18 |
const char *errors); |
| 19 |
extern void _Py_ClearFileSystemEncoding(void); |
| 20 |
extern PyStatus _PyUnicode_InitEncodings(PyThreadState *tstate); |
| 21 |
#ifdef MS_WINDOWS |
| 22 |
extern int _PyUnicode_EnableLegacyWindowsFSEncoding(void); |
| 23 |
#endif |
| 24 |
|
| 25 |
extern int _Py_IsLocaleCoercionTarget(const char *ctype_loc); |
| 26 |
|
| 27 |
/* Various one-time initializers */ |
| 28 |
|
| 29 |
extern void _Py_InitVersion(void); |
| 30 |
extern PyStatus _PyFaulthandler_Init(int enable); |
| 31 |
extern PyObject * _PyBuiltin_Init(PyInterpreterState *interp); |
| 32 |
extern PyStatus _PySys_Create( |
| 33 |
PyThreadState *tstate, |
| 34 |
PyObject **sysmod_p); |
| 35 |
extern PyStatus _PySys_ReadPreinitWarnOptions(PyWideStringList *options); |
| 36 |
extern PyStatus _PySys_ReadPreinitXOptions(PyConfig *config); |
| 37 |
extern int _PySys_UpdateConfig(PyThreadState *tstate); |
| 38 |
extern void _PySys_FiniTypes(PyInterpreterState *interp); |
| 39 |
extern int _PyBuiltins_AddExceptions(PyObject * bltinmod); |
| 40 |
extern PyStatus _Py_HashRandomization_Init(const PyConfig *); |
| 41 |
|
| 42 |
extern PyStatus _PyGC_Init(PyInterpreterState *interp); |
| 43 |
extern PyStatus _PyAtExit_Init(PyInterpreterState *interp); |
| 44 |
extern PyStatus _PyDateTime_InitTypes(PyInterpreterState *interp); |
| 45 |
|
| 46 |
/* Various internal finalizers */ |
| 47 |
|
| 48 |
extern int _PySignal_Init(int install_signal_handlers); |
| 49 |
extern void _PySignal_Fini(void); |
| 50 |
|
| 51 |
extern void _PyGC_Fini(PyInterpreterState *interp); |
| 52 |
extern void _Py_HashRandomization_Fini(void); |
| 53 |
extern void _PyFaulthandler_Fini(void); |
| 54 |
extern void _PyHash_Fini(void); |
| 55 |
extern void _PyTraceMalloc_Fini(void); |
| 56 |
extern void _PyWarnings_Fini(PyInterpreterState *interp); |
| 57 |
extern void _PyAST_Fini(PyInterpreterState *interp); |
| 58 |
extern void _PyAtExit_Fini(PyInterpreterState *interp); |
| 59 |
extern void _PyThread_FiniType(PyInterpreterState *interp); |
| 60 |
extern void _PyArg_Fini(void); |
| 61 |
extern void _Py_FinalizeAllocatedBlocks(_PyRuntimeState *); |
| 62 |
|
| 63 |
extern PyStatus _PyGILState_Init(PyInterpreterState *interp); |
| 64 |
extern void _PyGILState_SetTstate(PyThreadState *tstate); |
| 65 |
extern void _PyGILState_Fini(PyInterpreterState *interp); |
| 66 |
|
| 67 |
extern void _PyGC_DumpShutdownStats(PyInterpreterState *interp); |
| 68 |
|
| 69 |
extern PyStatus _Py_PreInitializeFromPyArgv( |
| 70 |
const PyPreConfig *src_config, |
| 71 |
const struct _PyArgv *args); |
| 72 |
extern PyStatus _Py_PreInitializeFromConfig( |
| 73 |
const PyConfig *config, |
| 74 |
const struct _PyArgv *args); |
| 75 |
|
| 76 |
extern wchar_t * _Py_GetStdlibDir(void); |
| 77 |
|
| 78 |
extern int _Py_HandleSystemExitAndKeyboardInterrupt(int *exitcode_p); |
| 79 |
|
| 80 |
extern PyObject* _PyErr_WriteUnraisableDefaultHook(PyObject *unraisable); |
| 81 |
|
| 82 |
extern void _PyErr_Print(PyThreadState *tstate); |
| 83 |
extern void _PyErr_Display(PyObject *file, PyObject *exception, |
| 84 |
PyObject *value, PyObject *tb); |
| 85 |
extern void _PyErr_DisplayException(PyObject *file, PyObject *exc); |
| 86 |
|
| 87 |
extern void _PyThreadState_DeleteCurrent(PyThreadState *tstate); |
| 88 |
|
| 89 |
extern void _PyAtExit_Call(PyInterpreterState *interp); |
| 90 |
|
| 91 |
extern int _Py_IsCoreInitialized(void); |
| 92 |
|
| 93 |
extern int _Py_FdIsInteractive(FILE *fp, PyObject *filename); |
| 94 |
|
| 95 |
extern const char* _Py_gitidentifier(void); |
| 96 |
extern const char* _Py_gitversion(void); |
| 97 |
|
| 98 |
// Export for '_asyncio' shared extension |
| 99 |
PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp); |
| 100 |
|
| 101 |
/* Random */ |
| 102 |
extern int _PyOS_URandom(void *buffer, Py_ssize_t size); |
| 103 |
|
| 104 |
// Export for '_random' shared extension |
| 105 |
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size); |
| 106 |
|
| 107 |
/* Legacy locale support */ |
| 108 |
extern int _Py_CoerceLegacyLocale(int warn); |
| 109 |
extern int _Py_LegacyLocaleDetected(int warn); |
| 110 |
|
| 111 |
// Export for 'readline' shared extension |
| 112 |
PyAPI_FUNC(char*) _Py_SetLocaleFromEnv(int category); |
| 113 |
|
| 114 |
// Export for special main.c string compiling with source tracebacks |
| 115 |
int _PyRun_SimpleStringFlagsWithName(const char *command, const char* name, PyCompilerFlags *flags); |
| 116 |
|
| 117 |
|
| 118 |
/* interpreter config */ |
| 119 |
|
| 120 |
// Export for _testinternalcapi shared extension |
| 121 |
PyAPI_FUNC(int) _PyInterpreterConfig_InitFromState( |
| 122 |
PyInterpreterConfig *, |
| 123 |
PyInterpreterState *); |
| 124 |
PyAPI_FUNC(PyObject *) _PyInterpreterConfig_AsDict(PyInterpreterConfig *); |
| 125 |
PyAPI_FUNC(int) _PyInterpreterConfig_InitFromDict( |
| 126 |
PyInterpreterConfig *, |
| 127 |
PyObject *); |
| 128 |
PyAPI_FUNC(int) _PyInterpreterConfig_UpdateFromDict( |
| 129 |
PyInterpreterConfig *, |
| 130 |
PyObject *); |
| 131 |
|
| 132 |
|
| 133 |
#ifdef __cplusplus |
| 134 |
} |
| 135 |
#endif |
| 136 |
#endif /* !Py_INTERNAL_LIFECYCLE_H */ |