From: Andrew M. Kuchling Date: Mon, 14 Dec 1998 19:36:14 +0000 (+0000) Subject: Fixed bug reported to Gregor Hoffleit: X-Git-Tag: v1.5.2b1~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c07f81d604dfebd769e0afd92ac7e8f9111f09f;p=thirdparty%2FPython%2Fcpython.git Fixed bug reported to Gregor Hoffleit: > mpz.mpz('\xff') should return mpz(255). Instead it returns > mpz(4294967295L). Looks like the constructor doesn't work with strings > containing characters above chr(128). Caused by using just 'char' where 'unsigned char' should have been used. --- diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c index e1fd7bfa4b16..7ae6937378a1 100644 --- a/Modules/mpzmodule.c +++ b/Modules/mpzmodule.c @@ -969,7 +969,7 @@ MPZ_mpz(self, args) mpz_clear(&mplongdigit); } else if (PyString_Check(objp)) { - char *cp = PyString_AS_STRING(objp); + unsigned char *cp = (unsigned char *)PyString_AS_STRING(objp); int len = PyString_GET_SIZE(objp); MP_INT mplongdigit;