]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
use Py_CHARMASK; and don't check for neg. float to the float power here
authorGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 17:00:37 +0000 (17:00 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 10 Feb 1995 17:00:37 +0000 (17:00 +0000)
Objects/floatobject.c
Objects/longobject.c
Objects/stringobject.c

index c7bdbed53fdba9ae12a4114668f3825ab067bb19..60dcca95295838586f5e7e9457727eaea0e00afc 100644 (file)
@@ -136,7 +136,7 @@ float_buf_repr(buf, v)
        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') {
@@ -330,10 +330,6 @@ float_pow(v, w, z)
                }
                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);
index b9935b033833b121e6cf55a345e24d578b0076d8..9c2dcf86401c23fd449c8f13bc7793f7eebc9bfb 100644 (file)
@@ -377,7 +377,7 @@ long_escan(str, pend, base)
                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;
@@ -385,7 +385,7 @@ long_escan(str, pend, base)
                ++str;
                sign = -1;
        }
-       while (*str != '\0' && isspace(*str))
+       while (*str != '\0' && isspace(Py_CHARMASK(*str)))
                str++;
        if (base == 0) {
                if (str[0] != '0')
index d9366aedadc160fac3252012118babe42eb143c6..7df894e12c76f517e115ad7c3ba9066d3130d534 100644 (file)
@@ -749,10 +749,10 @@ formatstring(format, args)
                                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) {
@@ -782,10 +782,10 @@ formatstring(format, args)
                                        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) {
@@ -913,7 +913,7 @@ formatstring(format, args)
                                --rescnt;
                                *res++ = ' ';
                        }
-                        if (dict && (argidx < arglen)) {
+                        if (dict && (argidx < arglen) && c != '%') {
                                 err_setstr(TypeError,
                                            "not all arguments converted");
                                 goto error;