From: Serhiy Storchaka Date: Tue, 29 Jan 2013 08:37:39 +0000 (+0200) Subject: Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. X-Git-Tag: v3.4.0a1~1507 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fe5a9f9c309c50ff0cf3312483056d828cc61ec;p=thirdparty%2FPython%2Fcpython.git Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. --- 8fe5a9f9c309c50ff0cf3312483056d828cc61ec diff --cc Misc/NEWS index b400a6e20c98,f8860058de1c..a92b9296fd36 --- a/Misc/NEWS +++ 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. diff --cc Objects/unicodeobject.c index b4f4185caacf,b559cb1cbda3..6eaccbe08456 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@@ -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 */ @@@ -5602,8 -5701,18 +5571,17 @@@ } 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