summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-11 17:25:52 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-11 17:25:52 (GMT)
commitb03ccc047278728d6d7173759bdbe83f22ecd9bc (patch)
tree10408bd0e5ea4f9fce80f744881ea9274f848735 /Objects/object.c
parent0368b726a1859e3c063df5a93f19ccb4254be22a (diff)
downloadcpython-b03ccc047278728d6d7173759bdbe83f22ecd9bc.zip
cpython-b03ccc047278728d6d7173759bdbe83f22ecd9bc.tar.gz
cpython-b03ccc047278728d6d7173759bdbe83f22ecd9bc.tar.bz2
Simplify PyObject_Unicode(NULL) by using
PyUnicode_FromString().
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 8597d88..4b210f1 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -435,14 +435,9 @@ PyObject_Unicode(PyObject *v)
PyObject *str;
static PyObject *unicodestr;
- if (v == NULL) {
- res = PyString_FromString("<NULL>");
- if (res == NULL)
- return NULL;
- str = PyUnicode_FromEncodedObject(res, NULL, "strict");
- Py_DECREF(res);
- return str;
- } else if (PyUnicode_CheckExact(v)) {
+ if (v == NULL)
+ return PyUnicode_FromString("<NULL>");
+ else if (PyUnicode_CheckExact(v)) {
Py_INCREF(v);
return v;
}