From: Guido van Rossum Date: Fri, 22 Aug 1997 04:20:13 +0000 (+0000) Subject: Added new Py_IsInitalized() API function to test the 'initialized' flag. X-Git-Tag: v1.5a4~336 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3c0d5eb3452f8bfcc15bf1e2985dcc83fa01901;p=python Added new Py_IsInitalized() API function to test the 'initialized' flag. --- diff --git a/Include/pythonrun.h b/Include/pythonrun.h index 09d3b57e8a..7d4f056078 100644 --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -42,6 +42,7 @@ char *Py_GetProgramName Py_PROTO((void)); void Py_Initialize Py_PROTO((void)); void Py_Finalize Py_PROTO((void)); +int Py_IsInitialized Py_PROTO((void)); PyThreadState *Py_NewInterpreter Py_PROTO((void)); void Py_EndInterpreter Py_PROTO((PyThreadState *)); diff --git a/PC/python_nt.def b/PC/python_nt.def index 786d072dc8..2e4010841a 100644 --- a/PC/python_nt.def +++ b/PC/python_nt.def @@ -220,6 +220,8 @@ EXPORTS Py_FatalError Py_Exit Py_Initialize + Py_Finalize + Py_IsInitialized PyErr_Print PyParser_SimpleParseFile PyParser_SimpleParseString diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 9f977f05b4..22cb86bdca 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -78,6 +78,14 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ static int initialized = 0; +/* API to access the initialized flag -- useful for eroteric use */ + +int +Py_IsInitialized() +{ + return initialized; +} + /* Global initializations. Can be undone by Py_Finalize(). Don't call this twice without an intervening Py_Finalize() call. When initializations fail, a fatal error is issued and the function does