Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3c0d5e

Browse files
committed
Added new Py_IsInitalized() API function to test the 'initialized' flag.
1 parent 779133c commit e3c0d5e

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

Include/pythonrun.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ char *Py_GetProgramName Py_PROTO((void));
4242

4343
void Py_Initialize Py_PROTO((void));
4444
void Py_Finalize Py_PROTO((void));
45+
int Py_IsInitialized Py_PROTO((void));
4546
PyThreadState *Py_NewInterpreter Py_PROTO((void));
4647
void Py_EndInterpreter Py_PROTO((PyThreadState *));
4748

PC/python_nt.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ EXPORTS
220220
Py_FatalError
221221
Py_Exit
222222
Py_Initialize
223+
Py_Finalize
224+
Py_IsInitialized
223225
PyErr_Print
224226
PyParser_SimpleParseFile
225227
PyParser_SimpleParseString

Python/pythonrun.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
7878

7979
static int initialized = 0;
8080

81+
/* API to access the initialized flag -- useful for eroteric use */
82+
83+
int
84+
Py_IsInitialized()
85+
{
86+
return initialized;
87+
}
88+
8189
/* Global initializations. Can be undone by Py_Finalize(). Don't
8290
call this twice without an intervening Py_Finalize() call. When
8391
initializations fail, a fatal error is issued and the function does

0 commit comments

Comments
 (0)