summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-10 17:00:37 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-10 17:00:37 (GMT)
commit9fa2c116139a22d647fc736cf36dfd815c6de944 (patch)
treee4db1c79b8e5adf691f1d418e9a074ff2c906cd7 /Objects/stringobject.c
parent2497eada60349dc5f2eb8314f2128069374a35a2 (diff)
downloadcpython-9fa2c116139a22d647fc736cf36dfd815c6de944.zip
cpython-9fa2c116139a22d647fc736cf36dfd815c6de944.tar.gz
cpython-9fa2c116139a22d647fc736cf36dfd815c6de944.tar.bz2
use Py_CHARMASK; and don't check for neg. float to the float power here
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index d9366ae..7df894e 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -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;