Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 50544:c9e5c1fa285e 3.0
Merged revisions 67937-67938 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
r67937 | alexandre.vassalotti | 2008-12-27 08:32:41 +0100 (Sat, 27 Dec 2008) | 3 lines
Update copy of PyUnicode_EncodeRawUnicodeEscape in _pickle.
Add astral character test case.
........
r67938 | alexandre.vassalotti | 2008-12-27 10:09:15 +0100 (Sat, 27 Dec 2008) | 3 lines
Fix wrong bytes type conversion in PyUnicode_AsUnicodeEscapeString.
Fix wrong bytes type conversion in PyUnicode_AsUnicodeDecodeString.
........
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 03 Jan 2009 23:34:15 +0000 |
| parents | fd4da855d603 |
| children | c06faa8196b3 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Sat Jan 03 23:32:31 2009 +0000 +++ b/Objects/unicodeobject.c Sat Jan 03 23:34:15 2009 +0000 @@ -3257,20 +3257,14 @@ PyObject *PyUnicode_AsUnicodeEscapeString(PyObject *unicode) { - PyObject *s, *result; + PyObject *s; if (!PyUnicode_Check(unicode)) { PyErr_BadArgument(); return NULL; } s = PyUnicode_EncodeUnicodeEscape(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode)); - - if (!s) - return NULL; - result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(s), - PyByteArray_GET_SIZE(s)); - Py_DECREF(s); - return result; + return s; } /* --- Raw Unicode Escape Codec ------------------------------------------- */ @@ -3482,7 +3476,7 @@ PyObject *PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode) { - PyObject *s, *result; + PyObject *s; if (!PyUnicode_Check(unicode)) { PyErr_BadArgument(); return NULL; @@ -3490,12 +3484,7 @@ s = PyUnicode_EncodeRawUnicodeEscape(PyUnicode_AS_UNICODE(unicode), PyUnicode_GET_SIZE(unicode)); - if (!s) - return NULL; - result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(s), - PyByteArray_GET_SIZE(s)); - Py_DECREF(s); - return result; + return s; } /* --- Unicode Internal Codec ------------------------------------------- */
