bpo-22257: Private C-API for main interpreter initialization (PEP 432). (#1729)

(patch by Nick Coghlan)
This commit is contained in:
Eric Snow 2017-05-23 23:00:52 -07:00 • committed by GitHub
parent 9e98cd0383
commit c7ec9985bb
5 changed files with 105 additions and 18 deletions

View file

@ -23,7 +23,8 @@ PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding,
/* PEP 432 Multi-phase initialization API (Private while provisional!) */
PyAPI_FUNC(void) _Py_InitializeCore(const _PyCoreConfig *);
PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
PyAPI_FUNC(int) _Py_InitializeMainInterpreter(int install_sigs);
PyAPI_FUNC(int) _Py_ReadMainInterpreterConfig(_PyMainInterpreterConfig *);
PyAPI_FUNC(int) _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *);
#endif
/* Initialization and finalization */

View file

@ -33,6 +33,18 @@ typedef struct {
#define _PyCoreConfig_INIT {0, -1, 0, 0}
/* Placeholders while working on the new configuration API
*
* See PEP 432 for final anticipated contents
*
* For the moment, just handle the args to _Py_InitializeEx
*/
typedef struct {
int install_signal_handlers;
} _PyMainInterpreterConfig;
#define _PyMainInterpreterConfig_INIT {-1}
typedef struct _is {
struct _is *next;
@ -53,6 +65,7 @@ typedef struct _is {
int fscodec_initialized;
_PyCoreConfig core_config;
_PyMainInterpreterConfig config;
#ifdef HAVE_DLOPEN
int dlopenflags;
#endif