diff Python/bltinmodule.c @ 41650:23a8b3dfbe95

Given that ord() of a bytes object of length 1 is defined, it should never return a negative number.
author Guido van Rossum <guido@python.org>
date Tue, 08 May 2007 21:05:48 +0000
parents 70472c157bb9
children 6ea93700d779
line wrap: on
line diff
--- a/Python/bltinmodule.c	Tue May 08 20:18:39 2007 +0000
+++ b/Python/bltinmodule.c	Tue May 08 21:05:48 2007 +0000
@@ -1482,7 +1482,7 @@
 		/* XXX Hopefully this is temporary */
 		size = PyBytes_GET_SIZE(obj);
 		if (size == 1) {
-			ord = (long)*PyBytes_AS_STRING(obj);
+			ord = (long)((unsigned char)*PyBytes_AS_STRING(obj));
 			return PyInt_FromLong(ord);
 		}
 	}