cpython: a4295ab52427 (original) (raw)
Mercurial > cpython
changeset 82387:a4295ab52427
(Merge 3.3) Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character outside the range U+0000-U+10ffff. [#17223]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Tue, 26 Feb 2013 00:16:57 +0100 |
parents | d98a82f4c9bd(current diff)c354afedb866(diff) |
children | 381de621ff6a |
files | Misc/NEWS Objects/unicodeobject.c |
diffstat | 2 files changed, 10 insertions(+), 7 deletions(-)[+] [-] Misc/NEWS 3 Objects/unicodeobject.c 14 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1? Core and Builtins ----------------- +- Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character outside
- Issue #17275: Corrected class name in init error messages of the C version of BufferedWriter and BufferedRandom.
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -241,7 +241,7 @@ static int unicode_modifiable(PyObject * static PyObject * -_PyUnicode_FromUCS1(const unsigned char *s, Py_ssize_t size); +_PyUnicode_FromUCS1(const Py_UCS1 *s, Py_ssize_t size); static PyObject * _PyUnicode_FromUCS2(const Py_UCS2 *s, Py_ssize_t size); static PyObject * @@ -432,7 +432,7 @@ unicode_result_wchar(PyObject *unicode) if (len == 1) { wchar_t ch = _PyUnicode_WSTR(unicode)[0];
if (ch < 256) {[](#l2.16)
if ((Py_UCS4)ch < 256) {[](#l2.17) PyObject *latin1_char = get_latin1_char((unsigned char)ch);[](#l2.18) Py_DECREF(unicode);[](#l2.19) return latin1_char;[](#l2.20)
@@ -1757,7 +1757,7 @@ PyUnicode_FromUnicode(const Py_UNICODE / Single character Unicode objects in the Latin-1 range are shared when using this constructor */
/* If not empty and not single character, copy the Unicode data @@ -1865,7 +1865,7 @@ PyObject* PyObject *unicode; if (size == 1) { #ifdef Py_DEBUG
assert(s[0] < 128);[](#l2.34)
assert((unsigned char)s[0] < 128);[](#l2.35)
#endif return get_latin1_char(s[0]); } @@ -1907,7 +1907,7 @@ align_maxchar(Py_UCS4 maxchar) } static PyObject* -_PyUnicode_FromUCS1(const unsigned char* u, Py_ssize_t size) +_PyUnicode_FromUCS1(const Py_UCS1* u, Py_ssize_t size) { PyObject *res; unsigned char max_char; @@ -2792,8 +2792,8 @@ PyUnicode_FromOrdinal(int ordinal) return NULL; }