[Python-Dev] Initialization hook for extenders

"Martin v. Löwis" martin@v.loewis.de
Thu, 01 May 2003 17:46:05 +0200


Patrick J. Miller wrote:

> It's not easy.
> 
> Not if you simply want to link against an installed Python.

Why not? Just don't call the function Py_Main.

> Nor so if you want to build against 2.1 2.2 and 2.3 ... libraries.

Again, I can't see a reason why that is.

> There are subtle changes that bite you in the ass if you don't
> physically copy the right source forward.

For example?

> We did copy forward main.c, but found that every time we updated
> Python, we had to "rehack" main to make sure we had all the options
> and flags and initialization straight.

That is not necessary. What would be the problem if you just left
your function as it was in Python 2.1?

> I think the hook is extremely cheap, very short, looks almost exactly
> like Py_AtExit() and solves the problem directly.

Unfortunately, the problem is one that almost nobody ever has, and 
supporting that API adds a maintenance burden. It is better if the
maintenance burden is on your side than on the Python core.

If you think you really need this, write a PEP, ask the community, and 
wait for BDFL pronouncement. I'm still -1.

Regards,
Martin