- Notifications
You must be signed in to change notification settings - Fork 31.8k
/
Copy pathgetversion.c
34 lines (27 loc) · 733 Bytes
/
getversion.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Return the full version string. */
#include"Python.h"
#include"patchlevel.h"
staticintinitialized=0;
staticcharversion[300];
void_Py_InitVersion(void)
{
if (initialized) {
return;
}
initialized=1;
#ifdefPy_GIL_DISABLED
constchar*buildinfo_format="%.80s experimental free-threading build (%.80s) %.80s";
#else
constchar*buildinfo_format="%.80s (%.80s) %.80s";
#endif
PyOS_snprintf(version, sizeof(version), buildinfo_format,
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
}
constchar*
Py_GetVersion(void)
{
_Py_InitVersion();
returnversion;
}
// Export the Python hex version as a constant.
constunsigned longPy_Version=PY_VERSION_HEX;