diff options
Diffstat (limited to 'Python/getversion.c')
-rw-r--r-- | Python/getversion.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Python/getversion.c b/Python/getversion.c index 46910451fdf..5db836ab4bf 100644 --- a/Python/getversion.c +++ b/Python/getversion.c @@ -5,12 +5,23 @@ #include "patchlevel.h" -const char * -Py_GetVersion(void) +static int initialized = 0; +static char version[250]; + +void _Py_InitVersion(void) { - static char version[250]; + if (initialized) { + return; + } + initialized = 1; PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s", PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); +} + +const char * +Py_GetVersion(void) +{ + _Py_InitVersion(); return version; } |