mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00

Remove the following old functions to configure the Python initialization, deprecated in Python 3.11: * PySys_AddWarnOptionUnicode() * PySys_AddWarnOption() * PySys_AddXOption() * PySys_HasWarnOptions() * PySys_SetArgvEx() * PySys_SetArgv() * PySys_SetPath() * Py_SetPath() * Py_SetProgramName() * Py_SetPythonHome() * Py_SetStandardStreamEncoding() * _Py_SetProgramFullPath() Most of these functions are kept in the stable ABI, except: * Py_SetStandardStreamEncoding() * _Py_SetProgramFullPath() Update Doc/extending/embedding.rst and Doc/extending/extending.rst to use the new PyConfig API. _testembed.c: * check_stdio_details() now sets stdio_encoding and stdio_errors of PyConfig. * Add definitions of functions removed from the API but kept in the stable ABI. * test_init_from_config() and test_init_read_set() now use PyConfig_SetString() instead of PyConfig_SetBytesString(). Remove _Py_ClearStandardStreamEncoding() internal function.
72 lines
2 KiB
C
72 lines
2 KiB
C
|
|
/* Interfaces to configure, query, create & destroy the Python runtime */
|
|
|
|
#ifndef Py_PYLIFECYCLE_H
|
|
#define Py_PYLIFECYCLE_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/* Initialization and finalization */
|
|
PyAPI_FUNC(void) Py_Initialize(void);
|
|
PyAPI_FUNC(void) Py_InitializeEx(int);
|
|
PyAPI_FUNC(void) Py_Finalize(void);
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
|
|
PyAPI_FUNC(int) Py_FinalizeEx(void);
|
|
#endif
|
|
PyAPI_FUNC(int) Py_IsInitialized(void);
|
|
|
|
/* Subinterpreter support */
|
|
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.
|
|
*/
|
|
PyAPI_FUNC(int) Py_AtExit(void (*func)(void));
|
|
|
|
PyAPI_FUNC(void) _Py_NO_RETURN Py_Exit(int);
|
|
|
|
/* Bootstrap __main__ (defined in Modules/main.c) */
|
|
PyAPI_FUNC(int) Py_Main(int argc, wchar_t **argv);
|
|
PyAPI_FUNC(int) Py_BytesMain(int argc, char **argv);
|
|
|
|
/* In pathconfig.c */
|
|
PyAPI_FUNC(wchar_t *) Py_GetProgramName(void);
|
|
PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void);
|
|
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);
|
|
#ifdef MS_WINDOWS
|
|
int _Py_CheckPython3(void);
|
|
#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);
|
|
|
|
/* 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);
|
|
|
|
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030B0000
|
|
PyAPI_DATA(const unsigned long) Py_Version;
|
|
#endif
|
|
|
|
#ifndef Py_LIMITED_API
|
|
# define Py_CPYTHON_PYLIFECYCLE_H
|
|
# include "cpython/pylifecycle.h"
|
|
# undef Py_CPYTHON_PYLIFECYCLE_H
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* !Py_PYLIFECYCLE_H */
|