Prepare for Python "Limited API" in PL/Python
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 26 Feb 2025 15:14:16 +0000 (16:14 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 26 Feb 2025 15:14:39 +0000 (16:14 +0100)
commitc47e8df815c1c45f4e4fc90d5817d67ab088279f
tree3302d85398d391115c202da0155cbc9c34983f29
parent0e42d31b0b2273c376ce9de946b59d155fac589c
Prepare for Python "Limited API" in PL/Python

Using the Python Limited API would allow building PL/Python against
any Python 3.x version and using another Python 3.x version at run
time.  This commit does not activate that, but it prepares the code to
only use APIs supported by the Limited API.

Implementation details:

- Convert static types to heap types
  (https://docs.python.org/3/howto/isolating-extensions.html#heap-types).

- Replace PyRun_String() with component functions.

- Replace PyList_SET_ITEM() with PyList_SetItem().

Reviewed-by: Jakob Egger <jakob@eggerapps.at>
Discussion: https://www.postgresql.org/message-id/flat/ee410de1-1e0b-4770-b125-eeefd4726a24@eisentraut.org
src/pl/plpython/plpy_cursorobject.c
src/pl/plpython/plpy_planobject.c
src/pl/plpython/plpy_procedure.c
src/pl/plpython/plpy_resultobject.c
src/pl/plpython/plpy_subxactobject.c
src/pl/plpython/plpy_typeio.c