[Python-Dev] Python build question (fixing pymath.c).

Brett Cannon brett at python.org
Sun Sep 27 09:48:13 CEST 2009

On Sun, Sep 27, 2009 at 00:21, Mark Dickinson <dickinsm at gmail.com> wrote:
> Hello all,
> I'm looking for advice on how to clean up an ugliness (one
> that I'm at least partly responsible for) in the Python build setup.
> Here's the problem:  some of the exported functions (e.g. atanh,
> log1p) in the Python/pymath.c file aren't needed by the Python core
> at all; they're exported solely for use in the math and cmath modules.
> Even worse, these exported functions have no '_Py' or 'Py' prefix.
> Since I'm currently working on adding some oft-requested
> functions to the math module (gamma, lgamma, erf, ...) it seemed
> like a good time to clean this up.
> So I've now got a file Modules/math_support.c that contains
> some functions needed by both mathmodule.c and
> cmathmodule.c, as well as a couple of functions only
> currently needed by the math module.  How should I incorporate
> this file into the build?
> One obvious solution seems to be to build an extra math_support.so
> file that's then used by both mathmodule.so and cmathmodule.so.
> Is this a sensible solution?  Are there better ways?

Are you planning on exposing any of this outside of those two modules?
If not then I would change the name to _math.so

> A complication to bear in mind is that some users may want to
> alter Modules/Setup.dist so that either the math module and/or
> the cmath module is included in the core Python executable.

If you are mucking with Modules.Setup.dist you better know how to
figure out that those two modules depend on another .so.


More information about the Python-Dev mailing list