[Python-checkins] r67938 - python/branches/py3k/Objects/unicodeobject.c

alexandre.vassalotti python-checkins at python.org
Sat Dec 27 10:09:15 CET 2008


Author: alexandre.vassalotti
Date: Sat Dec 27 10:09:15 2008
New Revision: 67938
Log:
Fix wrong bytes type conversion in PyUnicode_AsUnicodeEscapeString.
Fix wrong bytes type conversion in PyUnicode_AsUnicodeDecodeString.
Modified:
 python/branches/py3k/Objects/unicodeobject.c
Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c	(original)
+++ python/branches/py3k/Objects/unicodeobject.c	Sat Dec 27 10:09:15 2008
@@ -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 ------------------------------------------- */


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /