diff Objects/unicodeobject.c @ 73680:f29d7d597fae 3.2

Issue #13093: Fix error handling on PyUnicode_EncodeDecimal() * Add tests for PyUnicode_EncodeDecimal() and PyUnicode_TransformDecimalToASCII() * Remove the unused "e" variable in replace()
author Victor Stinner <victor.stinner@haypocalc.com>
date Tue, 22 Nov 2011 01:45:37 +0100
parents ddfcb0de564f
children 40a211eb4fda 52fecdc1c5d8
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Mon Nov 21 20:16:44 2011 +0100
+++ b/Objects/unicodeobject.c	Tue Nov 22 01:45:37 2011 +0100
@@ -6323,11 +6323,10 @@
         }
         /* 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 @@
         }
     } 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 @@
             return NULL;
         i = 0;
         p = u->str;
-        e = self->length - str1->length;
         if (str1->length > 0) {
             while (n-- > 0) {
                 /* look for next match */