summaryrefslogtreecommitdiffstats
path: root/Modules/mpzmodule.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>1998-12-14 19:36:14 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>1998-12-14 19:36:14 (GMT)
commit4c07f81d604dfebd769e0afd92ac7e8f9111f09f (patch)
tree80aeaadd57edcac4bfdf8799b59ebd77cc216fe5 /Modules/mpzmodule.c
parentcada2938f70ab4162b3bd2905c34819fce87f416 (diff)
downloadcpython-4c07f81d604dfebd769e0afd92ac7e8f9111f09f.zip
cpython-4c07f81d604dfebd769e0afd92ac7e8f9111f09f.tar.gz
cpython-4c07f81d604dfebd769e0afd92ac7e8f9111f09f.tar.bz2
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.
Diffstat (limited to 'Modules/mpzmodule.c')
-rw-r--r--Modules/mpzmodule.c2
1 files changed, 1 insertions, 1 deletions
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;