2014-11-20 07:39:37 -04:00
|
|
|
|
|
|
|
/* Interfaces to configure, query, create & destroy the Python runtime */
|
|
|
|
|
|
|
|
#ifndef Py_PYLIFECYCLE_H
|
|
|
|
#define Py_PYLIFECYCLE_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-12-12 07:55:04 -04:00
|
|
|
PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
|
2017-11-23 12:03:20 -04:00
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
|
|
|
|
|
2017-12-12 07:55:04 -04:00
|
|
|
PyAPI_FUNC(void) Py_SetPythonHome(const wchar_t *);
|
2017-11-23 12:03:20 -04:00
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
|
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
/* Only used by applications that embed the interpreter and need to
|
|
|
|
* override the standard encoding determination mechanism
|
|
|
|
*/
|
|
|
|
PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
|
|
|
|
const char *errors);
|
2018-08-28 20:29:06 -03:00
|
|
|
#endif
|
|
|
|
#ifdef Py_BUILD_CORE
|
|
|
|
PyAPI_FUNC(void) _Py_ClearStandardStreamEncoding(void);
|
|
|
|
#endif
|
2017-11-23 12:03:20 -04:00
|
|
|
|
2018-08-28 20:29:06 -03:00
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
2017-05-24 01:46:51 -03:00
|
|
|
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
|
2018-07-24 21:49:17 -03:00
|
|
|
PyAPI_FUNC(_PyInitError) _Py_InitializeCore(
|
|
|
|
PyInterpreterState **interp,
|
|
|
|
const _PyCoreConfig *);
|
2017-05-24 01:46:51 -03:00
|
|
|
PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
|
2017-11-24 17:55:40 -04:00
|
|
|
|
2017-12-13 21:20:52 -04:00
|
|
|
|
2017-12-19 18:48:17 -04:00
|
|
|
PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_Read(
|
|
|
|
_PyMainInterpreterConfig *config,
|
|
|
|
const _PyCoreConfig *core_config);
|
2017-11-24 17:55:40 -04:00
|
|
|
PyAPI_FUNC(void) _PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *);
|
2017-12-14 20:46:02 -04:00
|
|
|
PyAPI_FUNC(int) _PyMainInterpreterConfig_Copy(
|
|
|
|
_PyMainInterpreterConfig *config,
|
|
|
|
const _PyMainInterpreterConfig *config2);
|
2017-11-24 17:55:40 -04:00
|
|
|
|
2018-07-24 21:49:17 -03:00
|
|
|
PyAPI_FUNC(_PyInitError) _Py_InitializeMainInterpreter(
|
|
|
|
PyInterpreterState *interp,
|
|
|
|
const _PyMainInterpreterConfig *);
|
2014-11-20 07:39:37 -04:00
|
|
|
#endif
|
|
|
|
|
2017-05-24 01:46:51 -03:00
|
|
|
/* Initialization and finalization */
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(void) Py_Initialize(void);
|
|
|
|
PyAPI_FUNC(void) Py_InitializeEx(int);
|
|
|
|
#ifndef Py_LIMITED_API
|
2018-07-24 21:49:17 -03:00
|
|
|
PyAPI_FUNC(_PyInitError) _Py_InitializeFromConfig(
|
|
|
|
const _PyCoreConfig *config);
|
2018-08-01 11:41:25 -03:00
|
|
|
PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalInitError(_PyInitError err);
|
2014-11-20 07:39:37 -04:00
|
|
|
#endif
|
|
|
|
PyAPI_FUNC(void) Py_Finalize(void);
|
2015-11-29 23:18:29 -04:00
|
|
|
PyAPI_FUNC(int) Py_FinalizeEx(void);
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(int) Py_IsInitialized(void);
|
2017-05-24 01:46:51 -03:00
|
|
|
|
|
|
|
/* Subinterpreter support */
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void);
|
|
|
|
PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *);
|
|
|
|
|
|
|
|
|
|
|
|
/* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
|
|
|
|
* exit functions.
|
|
|
|
*/
|
|
|
|
#ifndef Py_LIMITED_API
|
2017-12-20 06:17:58 -04:00
|
|
|
PyAPI_FUNC(void) _Py_PyAtExit(void (*func)(PyObject *), PyObject *);
|
2014-11-20 07:39:37 -04:00
|
|
|
#endif
|
|
|
|
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
|
|
|
|
|
2018-08-01 11:41:25 -03:00
|
|
|
PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int);
|
2014-11-20 07:39:37 -04:00
|
|
|
|
|
|
|
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
PyAPI_FUNC(void) _Py_RestoreSignals(void);
|
|
|
|
|
|
|
|
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Bootstrap __main__ (defined in Modules/main.c) */
|
|
|
|
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
|
2017-12-15 23:54:22 -04:00
|
|
|
#ifdef Py_BUILD_CORE
|
|
|
|
PyAPI_FUNC(int) _Py_UnixMain(int argc, char **argv);
|
|
|
|
#endif
|
2014-11-20 07:39:37 -04:00
|
|
|
|
|
|
|
/* In getpath.c */
|
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void);
|
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetPrefix(void);
|
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void);
|
|
|
|
PyAPI_FUNC(wchar_t *) Py_GetPath(void);
|
2017-11-22 19:12:09 -04:00
|
|
|
#ifdef Py_BUILD_CORE
|
2018-07-20 21:06:16 -03:00
|
|
|
struct _PyPathConfig;
|
|
|
|
|
|
|
|
PyAPI_FUNC(_PyInitError) _PyPathConfig_SetGlobal(
|
2018-07-25 21:37:22 -03:00
|
|
|
const struct _PyPathConfig *config);
|
2017-12-13 16:05:57 -04:00
|
|
|
PyAPI_FUNC(PyObject*) _PyPathConfig_ComputeArgv0(int argc, wchar_t **argv);
|
2017-12-21 11:49:13 -04:00
|
|
|
PyAPI_FUNC(int) _Py_FindEnvConfigValue(
|
|
|
|
FILE *env_file,
|
|
|
|
const wchar_t *key,
|
|
|
|
wchar_t *value,
|
|
|
|
size_t value_size);
|
2017-11-22 19:12:09 -04:00
|
|
|
#endif
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(void) Py_SetPath(const wchar_t *);
|
|
|
|
#ifdef MS_WINDOWS
|
2017-12-04 08:39:15 -04:00
|
|
|
int _Py_CheckPython3(void);
|
2014-11-20 07:39:37 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* In their own files */
|
|
|
|
PyAPI_FUNC(const char *) Py_GetVersion(void);
|
|
|
|
PyAPI_FUNC(const char *) Py_GetPlatform(void);
|
|
|
|
PyAPI_FUNC(const char *) Py_GetCopyright(void);
|
|
|
|
PyAPI_FUNC(const char *) Py_GetCompiler(void);
|
|
|
|
PyAPI_FUNC(const char *) Py_GetBuildInfo(void);
|
|
|
|
#ifndef Py_LIMITED_API
|
2017-03-04 01:19:55 -04:00
|
|
|
PyAPI_FUNC(const char *) _Py_gitidentifier(void);
|
|
|
|
PyAPI_FUNC(const char *) _Py_gitversion(void);
|
2014-11-20 07:39:37 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Internal -- various one-time initializations */
|
|
|
|
#ifndef Py_LIMITED_API
|
|
|
|
PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void);
|
2017-11-15 19:48:08 -04:00
|
|
|
PyAPI_FUNC(_PyInitError) _PySys_BeginInit(PyObject **sysmod);
|
2017-12-14 21:05:29 -04:00
|
|
|
PyAPI_FUNC(int) _PySys_EndInit(PyObject *sysdict, _PyMainInterpreterConfig *config);
|
2017-12-06 12:25:50 -04:00
|
|
|
PyAPI_FUNC(_PyInitError) _PyImport_Init(PyInterpreterState *interp);
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod);
|
2017-11-15 19:48:08 -04:00
|
|
|
PyAPI_FUNC(_PyInitError) _PyImportHooks_Init(void);
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(int) _PyFloat_Init(void);
|
|
|
|
PyAPI_FUNC(int) PyByteArray_Init(void);
|
2017-12-14 19:51:22 -04:00
|
|
|
PyAPI_FUNC(_PyInitError) _Py_HashRandomization_Init(const _PyCoreConfig *);
|
|
|
|
#endif
|
2014-11-20 07:39:37 -04:00
|
|
|
|
|
|
|
/* Various internal finalizers */
|
2017-12-06 13:12:59 -04:00
|
|
|
|
|
|
|
#ifdef Py_BUILD_CORE
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(void) _PyExc_Fini(void);
|
|
|
|
PyAPI_FUNC(void) _PyImport_Fini(void);
|
2017-12-06 13:12:59 -04:00
|
|
|
PyAPI_FUNC(void) _PyImport_Fini2(void);
|
|
|
|
PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void);
|
|
|
|
PyAPI_FUNC(void) _PyGC_Fini(void);
|
|
|
|
PyAPI_FUNC(void) _PyType_Fini(void);
|
|
|
|
PyAPI_FUNC(void) _Py_HashRandomization_Fini(void);
|
|
|
|
#endif /* Py_BUILD_CORE */
|
|
|
|
|
|
|
|
#ifndef Py_LIMITED_API
|
2014-11-20 07:39:37 -04:00
|
|
|
PyAPI_FUNC(void) PyMethod_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyFrame_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyCFunction_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyDict_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyTuple_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyList_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PySet_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyBytes_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyByteArray_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyFloat_Fini(void);
|
|
|
|
PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
|
|
|
|
PyAPI_FUNC(void) PySlice_Fini(void);
|
2016-09-09 02:01:51 -03:00
|
|
|
PyAPI_FUNC(void) PyAsyncGen_Fini(void);
|
2014-11-20 07:39:37 -04:00
|
|
|
|
2017-09-08 02:51:28 -03:00
|
|
|
PyAPI_FUNC(int) _Py_IsFinalizing(void);
|
2017-12-06 13:12:59 -04:00
|
|
|
#endif /* !Py_LIMITED_API */
|
2014-11-20 07:39:37 -04:00
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
typedef void (*PyOS_sighandler_t)(int);
|
|
|
|
PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int);
|
|
|
|
PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t);
|
|
|
|
|
2016-09-11 05:03:14 -03:00
|
|
|
#ifndef Py_LIMITED_API
|
2014-11-20 07:39:37 -04:00
|
|
|
/* Random */
|
2016-09-06 20:33:52 -03:00
|
|
|
PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
|
|
|
|
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
|
2016-09-11 05:03:14 -03:00
|
|
|
#endif /* !Py_LIMITED_API */
|
2014-11-20 07:39:37 -04:00
|
|
|
|
2017-10-27 06:46:03 -03:00
|
|
|
/* Legacy locale support */
|
|
|
|
#ifndef Py_LIMITED_API
|
2017-12-15 23:54:22 -04:00
|
|
|
PyAPI_FUNC(void) _Py_CoerceLegacyLocale(const _PyCoreConfig *config);
|
2017-10-27 06:46:03 -03:00
|
|
|
PyAPI_FUNC(int) _Py_LegacyLocaleDetected(void);
|
2017-11-12 07:45:59 -04:00
|
|
|
PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
|
2017-10-27 06:46:03 -03:00
|
|
|
#endif
|
2018-08-29 06:47:29 -03:00
|
|
|
#ifdef Py_BUILD_CORE
|
|
|
|
PyAPI_FUNC(int) _Py_IsLocaleCoercionTarget(const char *ctype_loc);
|
|
|
|
#endif
|
2017-10-27 06:46:03 -03:00
|
|
|
|
2014-11-20 07:39:37 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_PYLIFECYCLE_H */
|