public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Re: Use Python "Limited API" in PL/Python
Date: Tue, 7 Jan 2025 08:34:39 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On 02.12.24 09:51, Peter Eisentraut wrote:
> This patch changes PL/Python to use the Python "limited API". This API 
> has stronger ABI stability guarantees.[0] This means, you can build PL/ 
> Python against any Python 3.x version and use any other Python 3.x 
> version at run time.
> 
> This is especially useful for binary packages where the operating system 
> does not come with a fixed suitable version of Python. For example, 
> Postgres.app (for macOS) would prefer to link against the Python version 
> supplied by python.org (Python.app). But that has a 3.x version that 
> changes over time. So instead they bundle a Python version inside 
> Postgres.app. The Windows installer used to also bundle Python but as of 
> PG17 you have to get it yourself, but you have to get a very specific 
> version [1], which is unsatisfactory. This patch fixes that: You can use 
> any Python version independent of what PL/Python was built against. 
> (There is a mechanism to say "at least 3.N", but for this patch, we 
> don't need that, we can stick with the current minimum of 3.2.)
> 
> (I have only tested the macOS side of this, not the Windows side. In 
> fact, the patch currently doesn't build on Windows on CI. I haven't 
> figured out why.)

A bit more exploration of that Windows build failure:

This patch changes it so that, on Windows, plpython is linked against a 
library called "python3.lib" instead of previously "python311.lib" or 
similar.  The build failure is [0]

     LINK : fatal error LNK1104: cannot open file 'python3.lib'

[0]: https://cirrus-ci.com/task/5738515637469184

which suggests that the file isn't there.  But we have tested this 
internally and the build succeeded locally.  I also don't see anything 
in the Python installer code or documentation that suggests that there 
is an option not to install that file or something like that.  It should 
be installed right next to the python3XX.lib file.

How could one debug this?  Is there a way to log into the CI image or 
get a directory dump or something like that?







view thread (14+ messages)  latest in thread

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]
  Subject: Re: Use 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