public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: [email protected]
Subject: pgsql: Prepare for Python "Limited API" in PL/Python
Date: Wed, 12 Mar 2025 07:58:53 +0000
Message-ID: <[email protected]> (raw)

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().

This was previously committed as c47e8df815c and then reverted because
it wasn't working under Python older than 3.8.  That has been fixed in
this version.  There was a Python API change/bugfix between 3.7 and
3.8 that directly affects this patch.  The relevant commit is
<https://github.com/python/cpython/commit/364f0b0f19c;.  The
workarounds described there have been applied in this patch, and it
has been confirmed to work with Python 3.6 and 3.7.

Reviewed-by: Jakob Egger <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/72a3d0462b9a7f6265267950668af0c0246e7c01

Modified Files
--------------
src/pl/plpython/plpy_cursorobject.c  |  84 +++++++++++++++++++--------
src/pl/plpython/plpy_planobject.c    |  70 +++++++++++++++-------
src/pl/plpython/plpy_procedure.c     |   5 +-
src/pl/plpython/plpy_resultobject.c  | 109 ++++++++++++++++++++++-------------
src/pl/plpython/plpy_subxactobject.c |  46 +++++++++------
src/pl/plpython/plpy_typeio.c        |   6 +-
6 files changed, 213 insertions(+), 107 deletions(-)



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Prepare for Python "Limited API" in PL/Python
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox