]> granicus.if.org Git - python/commitdiff
Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 29 Jan 2013 08:37:39 +0000 (10:37 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 29 Jan 2013 08:37:39 +0000 (10:37 +0200)
1  2 
Lib/test/test_codecs.py
Misc/NEWS
Objects/unicodeobject.c

Simple merge
diff --cc Misc/NEWS
index b400a6e20c984d3ddbf5b793f2f9c188d8837a71,f8860058de1c27d26f5b09f5c4f0d2d75076cc85..a92b9296fd360e405afa79576bb7a6307d4439e3
+++ b/Misc/NEWS
@@@ -234,11 -162,8 +234,13 @@@ Core and Builtin
  Library
  -------
  
+ - Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder.
 +Have py_compile use importlib as much as possible to avoid code duplication.
 +
 +- Issue #180022: Have site.addpackage() consider already known paths even when
 +  none are explicitly passed in. Bug report and fix by Kirill.
 +
  - Issue #1602133: on Mac OS X a shared library build (``--enable-shared``)
    now fills the ``os.environ`` variable correctly.
  
index b4f4185caacf25acac01d6922a330619a87f1af9,b559cb1cbda3d1ed20f153bf9466ff2860749a04..6eaccbe08456048c119c848c764814503e70b6f0
@@@ -5378,8 -5508,7 +5378,7 @@@ PyUnicode_DecodeUnicodeEscape(const cha
      const char *starts = s;
      Py_ssize_t startinpos;
      Py_ssize_t endinpos;
-     int j;
 -    PyObject *v;
 +    _PyUnicodeWriter writer;
      const char *end;
      char* message;
      Py_UCS4 chr = 0xffffffff; /* in case 'getcode' messes up */
              }
              break;
          }
-       nextByte:
-         ;
+         continue;
+       error:
+         endinpos = s-starts;
 -        if (unicode_decode_call_errorhandler(
++        if (unicode_decode_call_errorhandler_writer(
+                 errors, &errorHandler,
+                 "unicodeescape", message,
+                 &starts, &end, &startinpos, &endinpos, &exc, &s,
 -                &v, &i))
++                &writer))
+             goto onError;
 -        len = PyUnicode_GET_LENGTH(v);
+         continue;
      }
  #undef WRITECHAR