[Python-bugs-list] [ python-Bugs-493631 ] Problem with mpz module (gmp4)

noreply@sourceforge.net noreply@sourceforge.net
Sat, 15 Dec 2001 09:45:18 -0800


Bugs item #493631, was opened at 2001-12-15 04:17
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=493631&group_id=5470

Category: Extension Modules
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Damien Wyart (chlick)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem with mpz module (gmp4)

Initial Comment:
Trying to compile latest Python-2.2 (rc1), I found
the following problem : I can't compile mpzmodule.c
without modifying it.

I use gcc-3.0.2 and gmp-4.0. I am not a gmp not a
Python expert, but the problems seems to come
mainly from lack of clear support of gmp-4 in
mpzmodule.c.

MPZ_GET_STR_BUG is obsolete now, and should not be
used with gmp-4. #ifdef cases with 
MPZ_GET_STR_BUG defined uses obsolete struct field
calls and leads to compilation problems.

In fact, gmp-mparam.h should be included in all cases
(not only when MPZ_GET_STR_BUG defined), and the whole
file should be cleaned a bit to fully support gmp4.
including longlong.h is not necessary.

For now, there are two alternatives : gmp is gmp-2 and
is really bogus, or gmp is not 2 and is bogus with
respect to MPZ_GET_STR_BUG. The alternative "gmp-4"
(not bogus) should be added.

----------------------------------------------------------------------

>Comment By: Damien Wyart (chlick)
Date: 2001-12-15 09:45

Message:
Logged In: YES 
user_id=402822

OK, I will have a look at it and also contact gmp main author.

I will let you know about it asap...

Thanks for your kindness and patience.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-15 09:26

Message:
Logged In: YES 
user_id=6380

You're right, Python does not depend on GMP or MPZ for its
long arithmetic.

There's no mpz maintainer that I know of, so a patch would
be much appreciated!

----------------------------------------------------------------------

Comment By: Damien Wyart (chlick)
Date: 2001-12-15 08:48

Message:
Logged In: YES 
user_id=402822

In fact, I was quite afraid by this bug at first (I'm not a
Python expert, as already said), because I knew arbitrary
length integers support had changed in 2.2, and thought the
mp support module was directly used for bignum calculations!
This is not the case, because you said this bug hasn't to be
killed before official 2.2.

I could provide a patch bypassing the MPZ_GET_STR thing for
gmp-4, but as I do not know the situation about gmp versions
between 2 and 4, this is not really safe. I have been able
to compile fine, but this was more a hack than a clean
patching, and not suitable for all versions of gmp. If there
is an official mpz maintainer, I think it would be better he
handles the job. If there is no maintainer at all, I can try
to provide a fix, but will have to get in touch with gmp
author and act calmly. So this could take a while.

Thanks for your answers.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-15 08:26

Message:
Logged In: YES 
user_id=6380

However there's gmpy.sf.net, which appears a more recent GMP
wrapper for Python.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-15 08:18

Message:
Logged In: YES 
user_id=6380

I apologize, pympz.sf.net doesn't exist (anymore?). I don't
know what happened to it.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-15 08:08

Message:
Logged In: YES 
user_id=6380

I'm afraid we won't have time to fix the mpz module before
the planned final release of 2.2 next week, although I'll
see if we have someone on call who understands the issues.
If you want to help by providing a patch, that would work
too!

According to some comments in setup.py, there's an improved
mpz wrapper for Python here: pympz.sf.net.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=493631&group_id=5470