pycore_pylifecycle.h 3.7 KB

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