[Python-Dev] Optionally using GMP to implement long if available

M.-A. Lemburg mal at egenix.com
Tue Nov 4 19:58:21 CET 2008

On 2008-11-04 18:38, Victor Stinner wrote:
> Le Monday 03 November 2008 18:56:37 Paul Miller, vous avez écrit :
>> Rather than that, what about patching Python's long implementation 
>> to use GMP if it's available, and the default implementation if not?
> Yes, I like this suggestion of two flavors. Python with GMP and Python without 
> GMP (builtin integer library). It's "easy" to change the long type 
> implementation since only few modules use PyLong internals:
>  - mashal: import/export (.pyc)
>    => core function might be moved to longobject.c
>  - math: use some special features of the PyLong type
>    => macro can be written for that
> or simplify a #ifdef.

Ahem, what about the gazillion extension modules out there ?

You cannot simply change the long implementation and expect
everything to just work. Besides, like Tim already said: adding
lots and lots of #ifdefs is just going to make it harder
to maintain the implementation without gaining anything much.

I don't really see much of a need for this anyway. If people
want to use GMP they can download gmpy or PyGMP or our
experimental mxNumber extension:


Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Nov 04 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-Dev mailing list