summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2025-03-14 07:17:40 +0000
committerPeter Eisentraut2025-03-14 07:57:02 +0000
commit0793ab810038999c0659b3aad9525aa7ef4c8c26 (patch)
treef86ecaa60a25ad548e0bfd14e4971f0c570b0fe7
parent05cbd6cb22d235d2e52ac309266a5fc50053dc16 (diff)
Activate Python "Limited API" in PL/Python
This allows building PL/Python against any Python 3.x version and using another Python 3.x version at run time. This is useful for installers that want to run against a separately downloaded Python, so that they don't have to bundle it themselves. This builds on the earlier patch to only use APIs supported by the Limited API. At the moment, this is not activated on MSVC because that leads to build failures that no one could explain or cared enough to address. This could be done later. Reviewed-by: Jakob Egger <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
-rw-r--r--src/pl/plpython/plpython.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h
index ec822577260..06fc1a5440f 100644
--- a/src/pl/plpython/plpython.h
+++ b/src/pl/plpython/plpython.h
@@ -20,6 +20,15 @@
#endif
/*
+ * Enable Python Limited API
+ *
+ * XXX currently not enabled on MSVC because of build failures
+ */
+#if !defined(_MSC_VER)
+#define Py_LIMITED_API 0x03020000
+#endif
+
+/*
* Pull in Python headers via a wrapper header, to control the scope of
* the system_header pragma therein.
*/