aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Python/getversion.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-12 07:53:52 +0300
committershadchin <shadchin@yandex-team.com>2024-02-12 08:07:36 +0300
commitce1b7ca3171f9158180640c6a02a74b4afffedea (patch)
treee47c1e8391b1b0128262c1e9b1e6ed4c8fff2348 /contrib/tools/python3/src/Python/getversion.c
parent57350d96f030db90f220ce50ee591d5c5d403df7 (diff)
downloadydb-ce1b7ca3171f9158180640c6a02a74b4afffedea.tar.gz
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Python/getversion.c')
-rw-r--r--contrib/tools/python3/src/Python/getversion.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/tools/python3/src/Python/getversion.c b/contrib/tools/python3/src/Python/getversion.c
index 46910451fd..5db836ab4b 100644
--- a/contrib/tools/python3/src/Python/getversion.c
+++ b/contrib/tools/python3/src/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;
}