summaryrefslogtreecommitdiffstats
path: root/Include/pymacro.h
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2025-01-09 10:10:28 (GMT)
committerGitHub <noreply@github.com>2025-01-09 10:10:28 (GMT)
commit1439b81928f1b52c5a0ac7fd81fdd66afd5f72da (patch)
tree327fda70fac52911985d6c15f062e374a3734fd6 /Include/pymacro.h
parent4685401845ba3e2ab8c9f4a9a10aa2969b11985f (diff)
downloadcpython-1439b81928f1b52c5a0ac7fd81fdd66afd5f72da.zip
cpython-1439b81928f1b52c5a0ac7fd81fdd66afd5f72da.tar.gz
cpython-1439b81928f1b52c5a0ac7fd81fdd66afd5f72da.tar.bz2
gh-128629: Add Py_PACK_VERSION and Py_PACK_FULL_VERSION (GH-128630)
Diffstat (limited to 'Include/pymacro.h')
-rw-r--r--Include/pymacro.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h
index e0378f9..a82f347 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -190,4 +190,13 @@
// "comparison of unsigned expression in '< 0' is always false".
#define _Py_IS_TYPE_SIGNED(type) ((type)(-1) <= 0)
+#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030E0000 // 3.14
+// Version helpers. These are primarily macros, but have exported equivalents.
+PyAPI_FUNC(uint32_t) Py_PACK_FULL_VERSION(int x, int y, int z, int level, int serial);
+PyAPI_FUNC(uint32_t) Py_PACK_VERSION(int x, int y);
+#define Py_PACK_FULL_VERSION _Py_PACK_FULL_VERSION
+#define Py_PACK_VERSION(X, Y) Py_PACK_FULL_VERSION(X, Y, 0, 0, 0)
+#endif // Py_LIMITED_API < 3.14
+
+
#endif /* Py_PYMACRO_H */