Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/cpython
Path: blob/main/Python/getversion.c
12 views
1
2
/* Return the full version string. */
3
4
#include "Python.h"
5
6
#include "patchlevel.h"
7
8
static int initialized = 0;
9
static char version[250];
10
11
void _Py_InitVersion(void)
12
{
13
if (initialized) {
14
return;
15
}
16
initialized = 1;
17
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
18
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
19
}
20
21
const char *
22
Py_GetVersion(void)
23
{
24
_Py_InitVersion();
25
return version;
26
}
27
28
// Export the Python hex version as a constant.
29
const unsigned long Py_Version = PY_VERSION_HEX;
30
31