summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-03 07:54:09 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-03 07:54:09 (GMT)
commit3b9406b08aad04c1f92d7a2ab03c8a42c3afb8be (patch)
treea253380770225dafbaf79931e91bccd3ef65fb80 /Objects/unicodeobject.c
parentbd87d0862bd0ea3d978a27ca558a5f7ec4b32fe2 (diff)
downloadcpython-3b9406b08aad04c1f92d7a2ab03c8a42c3afb8be.zip
cpython-3b9406b08aad04c1f92d7a2ab03c8a42c3afb8be.tar.gz
cpython-3b9406b08aad04c1f92d7a2ab03c8a42c3afb8be.tar.bz2
Remove redundant check for PyBytes in unicode_encode.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index fd50882..f66773e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -7424,27 +7424,11 @@ unicode_encode(PyUnicodeObject *self, PyObject *args, PyObject *kwargs)
static char *kwlist[] = {"encoding", "errors", 0};
char *encoding = NULL;
char *errors = NULL;
- PyObject *v;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:encode",
kwlist, &encoding, &errors))
return NULL;
- v = PyUnicode_AsEncodedString((PyObject *)self, encoding, errors);
- if (v == NULL)
- goto onError;
- /* XXX this check is redundant */
- if (!PyBytes_Check(v)) {
- PyErr_Format(PyExc_TypeError,
- "encoder did not return a bytes object "
- "(type=%.400s)",
- Py_TYPE(v)->tp_name);
- Py_DECREF(v);
- return NULL;
- }
- return v;
-
- onError:
- return NULL;
+ return PyUnicode_AsEncodedString((PyObject *)self, encoding, errors);
}
PyDoc_STRVAR(transform__doc__,