summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-01-12 20:40:18 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-01-12 20:40:18 (GMT)
commit821e4cfd01a8d4a7d9b4c0ed6a14d27744d60b3f (patch)
treebe094d2634438c98bd3ec37aa080a1130c2d1ab3 /Objects/unicodeobject.c
parent1adbc6f56a7c08b06b42d8eddc5fd76cfa5815c7 (diff)
downloadcpython-821e4cfd01a8d4a7d9b4c0ed6a14d27744d60b3f.zip
cpython-821e4cfd01a8d4a7d9b4c0ed6a14d27744d60b3f.tar.gz
cpython-821e4cfd01a8d4a7d9b4c0ed6a14d27744d60b3f.tar.bz2
make fix_decimal_and_space_to_ascii check if it modifies the string
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6979050..034c691 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8845,6 +8845,7 @@ fix_decimal_and_space_to_ascii(PyObject *self)
const int kind = PyUnicode_KIND(self);
void *data = PyUnicode_DATA(self);
Py_UCS4 maxchar = 0, ch, fixed;
+ int modified = 0;
Py_ssize_t i;
for (i = 0; i < len; ++i) {
@@ -8859,6 +8860,7 @@ fix_decimal_and_space_to_ascii(PyObject *self)
fixed = '0' + decimal;
}
if (fixed != 0) {
+ modified = 1;
if (fixed > maxchar)
maxchar = fixed;
PyUnicode_WRITE(kind, data, i, fixed);
@@ -8870,7 +8872,7 @@ fix_decimal_and_space_to_ascii(PyObject *self)
maxchar = ch;
}
- return maxchar;
+ return (modified) ? maxchar : 0;
}
PyObject *