diff configmix/_speedups.c @ 547:1cbe8b0f2b78

Put the value of Py_LIMITED_API into the module dict when the C-extension is compiled against the stable API
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 01 Jan 2022 21:18:55 +0100
parents 6501fe0e116c
children 84657447ab39
line wrap: on
line diff
--- a/configmix/_speedups.c	Sat Jan 01 21:03:05 2022 +0100
+++ b/configmix/_speedups.c	Sat Jan 01 21:18:55 2022 +0100
@@ -481,6 +481,9 @@
     {NULL, NULL, 0, NULL}
 };
 
+#define STRINGIFY(s) #s
+#define XSTRINGIFY(s) STRINGIFY(s)
+
 
 static
 int
@@ -496,6 +499,9 @@
     PyModule_AddStringConstant(module, "__release__", release);
     PyModule_AddStringConstant(module, "__date__", date);
     PyModule_AddStringConstant(module, "__author__", "Franz Glasner");
+#if defined(Py_LIMITED_API)
+    PyModule_AddStringConstant(module, "Py_LIMITED_API", XSTRINGIFY(Py_LIMITED_API));
+#endif
 
     sstate->DOT = PyUnicode_FromStringAndSize(".", 1);
     if (sstate->DOT == NULL) {