[Python-Dev] Initialization hook for extenders

Patrick J. Miller patmiller@llnl.gov
Thu, 01 May 2003 08:23:07 -0700


"Martin v. L=F6wis" wrote:
> -1. It is easy enough to copy the code of Py_Main, and customize it
> for special requirements. The next user may want to have a hook to put
> additional command line options into Py_Main, YAGNI.

It's not easy.

Not if you simply want to link against an installed Python.

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

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

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.

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

Pat



--=20
Patrick Miller | (925) 423-0309 |
http://www.llnl.gov/CASC/people/pmiller

You can discover more about a person in an hour of play than in a year
of
discussion. -- Plato, philosopher (427-347 BCE)