diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-22 00:45:37 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-22 00:45:37 (GMT) |
commit | ab1d16b4561390022efc0a45fae1ce6cbb119a58 (patch) | |
tree | e7307b10973f0167102e0baf7d0363815af0fe25 /Objects | |
parent | 58fcf9f801d590b999401533154b63f4eb26ce6c (diff) | |
download | cpython-ab1d16b4561390022efc0a45fae1ce6cbb119a58.zip cpython-ab1d16b4561390022efc0a45fae1ce6cbb119a58.tar.gz cpython-ab1d16b4561390022efc0a45fae1ce6cbb119a58.tar.bz2 |
Issue #13093: Fix error handling on PyUnicode_EncodeDecimal()
* Add tests for PyUnicode_EncodeDecimal() and PyUnicode_TransformDecimalToASCII()
* Remove the unused "e" variable in replace()
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 8680726..d13c547 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -6323,11 +6323,10 @@ int PyUnicode_EncodeDecimal(Py_UNICODE *s, } /* All other characters are considered unencodable */ collstart = p; - collend = p+1; - while (collend < end) { + for (collend = p+1; collend < end; collend++) { if ((0 < *collend && *collend < 256) || - !Py_UNICODE_ISSPACE(*collend) || - Py_UNICODE_TODECIMAL(*collend)) + Py_UNICODE_ISSPACE(*collend) || + 0 <= Py_UNICODE_TODECIMAL(*collend)) break; } /* cache callback name lookup @@ -7004,7 +7003,7 @@ PyObject *replace(PyUnicodeObject *self, } } else { - Py_ssize_t n, i, j, e; + Py_ssize_t n, i, j; Py_ssize_t product, new_size, delta; Py_UNICODE *p; @@ -7036,7 +7035,6 @@ PyObject *replace(PyUnicodeObject *self, return NULL; i = 0; p = u->str; - e = self->length - str1->length; if (str1->length > 0) { while (n-- > 0) { /* look for next match */ |