Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 2308:14b126d0b5be legacy-trunk
use Py_CHARMASK; and don't check for neg. float to the float power here
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 10 Feb 1995 17:00:37 +0000 |
| parents | 866c81068dbd |
| children | 445bea8ceab1 |
line wrap: on
line diff
--- a/Objects/stringobject.c Fri Feb 10 17:00:27 1995 +0000 +++ b/Objects/stringobject.c Fri Feb 10 17:00:37 1995 +0000 @@ -749,10 +749,10 @@ 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 @@ 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 @@ --rescnt; *res++ = ' '; } - if (dict && (argidx < arglen)) { + if (dict && (argidx < arglen) && c != '%') { err_setstr(TypeError, "not all arguments converted"); goto error;
