pgsql: Prepare for Python "Limited API" in PL/Python

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prepare for Python "Limited API" in PL/Python
Date: 2025-02-26 15:31:43
Message-ID: E1tnJNu-000CZW-0X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)eggerapps(dot)at>
Discussion: https://www.postgresql.org/message-id/flat/ee410de1-1e0b-4770-b125-eeefd4726a24(at)eisentraut(dot)org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c47e8df815c1c45f4e4fc90d5817d67ab088279f

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c | 71 +++++++++++++++++---------
src/pl/plpython/plpy_planobject.c | 61 ++++++++++++++--------
src/pl/plpython/plpy_procedure.c | 5 +-
src/pl/plpython/plpy_resultobject.c | 98 ++++++++++++++++++++++--------------
src/pl/plpython/plpy_subxactobject.c | 41 ++++++++-------
src/pl/plpython/plpy_typeio.c | 6 +--
6 files changed, 177 insertions(+), 105 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-02-26 16:51:04 Re: pgsql: Prepare for Python "Limited API" in PL/Python
Previous Message Michael Paquier 2025-02-26 07:53:54 Re: pgsql: Remove redundant pg_set_*_stats() variants.