[Python-3000] C API for ints and strings
Jim Jewett
jimjjewett at gmail.com
Sun Sep 9 23:25:56 CEST 2007
On 9/8/07, Nicholas Bastin <nick.bastin at gmail.com> wrote:
> On 9/8/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > > Speaking of PyLong, and its' minor awkwardness to work with in C (you
> > > either have to convert to another multiple-precision type through a
> > > string, or use Python's arithmetic operators directly), was there any
> > > thought given to using something like GPM's mpz_t as the backing data
> > > type?
> Would anyone be opposed to rehosting PyLong on top of GMP?
(1) If there are concerns about the RCA attribution license, I would
expect much greater concerns about LGPL.
(2) License aside, does it really solve the problem you had about
needing to convert or use Python's arithmetic operations? At first
glance, it looks like you would still have the same problem, except
that you would need to use the GMP functions instead of the python
functions.
(3) Is it stable enough? I know it has been developed since 1991,
but they seem to focus on high performance for truly huge numbers. I
suspect the vast majority of python programs would perform fine if
they were limited to C ints, and so the extra costs may not be worth
it.
According to http://gmplib.org/
"""
IMPORTANT INFORMATION FOR ALL GMP USERS:
GMP is very often miscompiled! We are seeing ever increasing problems with
miscompilations of the GMP code. It has now come to the point where a
compiler should be assumed to miscompile GMP.
"""
Later details of issues with the current release include:
Garbage from some ternary ops (a=c+b*a) with the C++ wrappers (would
that apply to C++ python extensions?)
crash bugs
It doesn't work on the Intel Macintoshes, and the workarounds are so
ugly that they won't be applied to the trunk.
-jJ
More information about the Python-3000
mailing list