Python build question (fixing pymath.c).
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? 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. Cluelessly yours, Mark
On Sun, Sep 27, 2009 at 00:21, Mark Dickinson <dickinsm@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. -Brett
On Sun, Sep 27, 2009 at 8:48 AM, Brett Cannon <brett@python.org> wrote:
On Sun, Sep 27, 2009 at 00:21, Mark Dickinson <dickinsm@gmail.com> wrote: [...]
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?
No.
If not then I would change the name to _math.so
That makes sense.
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.
Sure. I'll at least add a comment pointing out the dependence, though. Thanks, Mark
participants (2)
-
Brett Cannon
-
Mark Dickinson