blob: 01abfa9fcd6fb7d1dd4228a523a0563679899a9e [file] [log] [blame]
Nick Coghland6009512014-11-20 21:39:37 +10001
2/* Interfaces to configure, query, create & destroy the Python runtime */
3
4#ifndef Py_PYLIFECYCLE_H
5#define Py_PYLIFECYCLE_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10PyAPI_FUNC(void) Py_SetProgramName(wchar_t *);
11PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
12
13PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *);
14PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
15
16#ifndef Py_LIMITED_API
17/* Only used by applications that embed the interpreter and need to
18 * override the standard encoding determination mechanism
19 */
20PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
21 const char *errors);
22#endif
23
24PyAPI_FUNC(void) Py_Initialize(void);
25PyAPI_FUNC(void) Py_InitializeEx(int);
26#ifndef Py_LIMITED_API
27PyAPI_FUNC(void) _Py_InitializeEx_Private(int, int);
28#endif
29PyAPI_FUNC(void) Py_Finalize(void);
Martin Panterb4ce1fc2015-11-30 03:18:29 +000030PyAPI_FUNC(int) Py_FinalizeEx(void);
Nick Coghland6009512014-11-20 21:39:37 +100031PyAPI_FUNC(int) Py_IsInitialized(void);
32PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
33PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
34
35
36/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
37 * exit functions.
38 */
39#ifndef Py_LIMITED_API
40PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(void));
41#endif
42PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
43
44PyAPI_FUNC(void) Py_Exit(int);
45
46/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
47#ifndef Py_LIMITED_API
48PyAPI_FUNC(void) _Py_RestoreSignals(void);
49
50PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
51#endif
52
53/* Bootstrap __main__ (defined in Modules/main.c) */
54PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
55
56/* In getpath.c */
57PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
58PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
59PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
60PyAPI_FUNC(wchar_t *) Py_GetPath(void);
61PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
62#ifdef MS_WINDOWS
63int _Py_CheckPython3();
64#endif
65
66/* In their own files */
67PyAPI_FUNC(const char *) Py_GetVersion(void);
68PyAPI_FUNC(const char *) Py_GetPlatform(void);
69PyAPI_FUNC(const char *) Py_GetCopyright(void);
70PyAPI_FUNC(const char *) Py_GetCompiler(void);
71PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
72#ifndef Py_LIMITED_API
Ned Deily95c50e52017-03-04 01:05:06 -050073PyAPI_FUNC(const char *) _Py_gitidentifier(void);
74PyAPI_FUNC(const char *) _Py_gitversion(void);
Nick Coghland6009512014-11-20 21:39:37 +100075#endif
76
77/* Internal -- various one-time initializations */
78#ifndef Py_LIMITED_API
79PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
80PyAPI_FUNC(PyObject *) _PySys_Init(void);
81PyAPI_FUNC(void) _PyImport_Init(void);
82PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
83PyAPI_FUNC(void) _PyImportHooks_Init(void);
84PyAPI_FUNC(int) _PyFrame_Init(void);
85PyAPI_FUNC(int) _PyFloat_Init(void);
86PyAPI_FUNC(int) PyByteArray_Init(void);
87PyAPI_FUNC(void) _PyRandom_Init(void);
88#endif
89
90/* Various internal finalizers */
91#ifndef Py_LIMITED_API
92PyAPI_FUNC(void) _PyExc_Fini(void);
93PyAPI_FUNC(void) _PyImport_Fini(void);
94PyAPI_FUNC(void) PyMethod_Fini(void);
95PyAPI_FUNC(void) PyFrame_Fini(void);
96PyAPI_FUNC(void) PyCFunction_Fini(void);
97PyAPI_FUNC(void) PyDict_Fini(void);
98PyAPI_FUNC(void) PyTuple_Fini(void);
99PyAPI_FUNC(void) PyList_Fini(void);
100PyAPI_FUNC(void) PySet_Fini(void);
101PyAPI_FUNC(void) PyBytes_Fini(void);
102PyAPI_FUNC(void) PyByteArray_Fini(void);
103PyAPI_FUNC(void) PyFloat_Fini(void);
104PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
105PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
106PyAPI_FUNC(void) _PyGC_Fini(void);
107PyAPI_FUNC(void) PySlice_Fini(void);
108PyAPI_FUNC(void) _PyType_Fini(void);
109PyAPI_FUNC(void) _PyRandom_Fini(void);
Yury Selivanoveb636452016-09-08 22:01:51 -0700110PyAPI_FUNC(void) PyAsyncGen_Fini(void);
Nick Coghland6009512014-11-20 21:39:37 +1000111
112PyAPI_DATA(PyThreadState *) _Py_Finalizing;
113#endif
114
115/* Signals */
116typedef void (*PyOS_sighandler_t)(int);
117PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
118PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
119
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +0300120#ifndef Py_LIMITED_API
Nick Coghland6009512014-11-20 21:39:37 +1000121/* Random */
Victor Stinnere66987e2016-09-06 16:33:52 -0700122PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
123PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
Serhiy Storchaka9fab79b2016-09-11 11:03:14 +0300124#endif /* !Py_LIMITED_API */
Nick Coghland6009512014-11-20 21:39:37 +1000125
126#ifdef __cplusplus
127}
128#endif
129#endif /* !Py_PYLIFECYCLE_H */