summaryrefslogtreecommitdiff
path: root/Python/getversion.c
diff options
context:
space:
mode:
authorGabriele N. Tornetta <P403n1x87@users.noreply.github.com>2021-12-10 01:52:05 +0000
committerGitHub <noreply@github.com>2021-12-09 17:52:05 -0800
commit50669083fe16a42cba90b5dd8c1a017751f69fd8 (patch)
treefc2a1c7425e20d7df0b4fa44b23fdf47b5bbf35c /Python/getversion.c
parentda3cf4304f6dd530533bbd2c0913b674cd803744 (diff)
downloadcpython-git-50669083fe16a42cba90b5dd8c1a017751f69fd8.tar.gz
bpo-43931: Export Python version as API data (GH-25577)
When Python is embedded in other applications, it is not easy to determine which version of Python is being used. This change exposes the Python version as part of the API data. Tools like Austin (https://github.com/P403n1x87/austin) can benefit from this data when targeting applications like uWSGI, as the Python version can then be inferred systematically by looking at the exported symbols rather than relying on unreliable pattern matching or other hacks (like remote code execution etc...). Automerge-Triggered-By: GH:pablogsal
Diffstat (limited to 'Python/getversion.c')
-rw-r--r--Python/getversion.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/getversion.c b/Python/getversion.c
index c32b6f9d60..46910451fd 100644
--- a/Python/getversion.c
+++ b/Python/getversion.c
@@ -13,3 +13,6 @@ Py_GetVersion(void)
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
return version;
}
+
+// Export the Python hex version as a constant.
+const unsigned long Py_Version = PY_VERSION_HEX;