From 4c07f81d604dfebd769e0afd92ac7e8f9111f09f Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Mon, 14 Dec 1998 19:36:14 +0000 Subject: 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. --- Modules/mpzmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c index e1fd7bf..7ae6937 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; -- cgit v0.12