Commits

Anonymous committed 14b126d

use Py_CHARMASK; and don't check for neg. float to the float power here

Comments (0)

Files changed (3)

Objects/floatobject.c

 	for (; *cp != '\0'; cp++) {
 		/* Any non-digit means it's not an integer;
 		   this takes care of NAN and INF as well. */
-		if (!isdigit(*cp))
+		if (!isdigit(Py_CHARMASK(*cp)))
 			break;
 	}
 	if (*cp == '\0') {
 		}
 		return newfloatobject(0.0);
 	}
-	if (iv < 0.0) {
-		err_setstr(ValueError, "negative float to float power");
-		return NULL;
-	}
 	errno = 0;
 	ix = pow(iv, iw);
 	CHECK(ix);
 		err_setstr(ValueError, "invalid base for long literal");
 		return NULL;
 	}
-	while (*str != '\0' && isspace(*str))
+	while (*str != '\0' && isspace(Py_CHARMASK(*str)))
 		str++;
 	if (*str == '+')
 		++str;
 		++str;
 		sign = -1;
 	}
-	while (*str != '\0' && isspace(*str))
+	while (*str != '\0' && isspace(Py_CHARMASK(*str)))
 		str++;
 	if (base == 0) {
 		if (str[0] != '0')

Objects/stringobject.c

 				if (--fmtcnt >= 0)
 					c = *fmt++;
 			}
-			else if (isdigit(c)) {
+			else if (c >= 0 && isdigit(c)) {
 				width = c - '0';
 				while (--fmtcnt >= 0) {
-					c = *fmt++;
+					c = Py_CHARMASK(*fmt++);
 					if (!isdigit(c))
 						break;
 					if ((width*10) / 10 != width) {
 					if (--fmtcnt >= 0)
 						c = *fmt++;
 				}
-				else if (isdigit(c)) {
+				else if (c >= 0 && isdigit(c)) {
 					prec = c - '0';
 					while (--fmtcnt >= 0) {
-						c = *fmt++;
+						c = Py_CHARMASK(*fmt++);
 						if (!isdigit(c))
 							break;
 						if ((prec*10) / 10 != prec) {
 				--rescnt;
 				*res++ = ' ';
 			}
-                        if (dict && (argidx < arglen)) {
+                        if (dict && (argidx < arglen) && c != '%') {
                                 err_setstr(TypeError,
                                            "not all arguments converted");
                                 goto error;