summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-26 04:19:43 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-26 04:19:43 (GMT)
commit6ea45d33412d4ecb2862645d57137b7ea1223281 (patch)
tree90a60a1298fff16a71f2501e87613385624a52d9 /Objects/object.c
parent5b0fdc9d0aef58fffe225bee493d62cd905d6b80 (diff)
downloadcpython-6ea45d33412d4ecb2862645d57137b7ea1223281.zip
cpython-6ea45d33412d4ecb2862645d57137b7ea1223281.tar.gz
cpython-6ea45d33412d4ecb2862645d57137b7ea1223281.tar.bz2
Use unicode and remove support for some uses of str8.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 04d5f48..dd68ecd 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -357,7 +357,7 @@ _PyObject_Dump(PyObject* op)
PyObject *
PyObject_Repr(PyObject *v)
{
- PyObject *ress, *resu;
+ PyObject *res;
if (PyErr_CheckSignals())
return NULL;
#ifdef USE_STACKCHECK
@@ -371,21 +371,15 @@ PyObject_Repr(PyObject *v)
else if (Py_Type(v)->tp_repr == NULL)
return PyUnicode_FromFormat("<%s object at %p>", v->ob_type->tp_name, v);
else {
- ress = (*v->ob_type->tp_repr)(v);
- if (!ress)
- return NULL;
- if (PyUnicode_Check(ress))
- return ress;
- if (!PyString_Check(ress)) {
+ res = (*v->ob_type->tp_repr)(v);
+ if (res != NULL && !PyUnicode_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__repr__ returned non-string (type %.200s)",
- ress->ob_type->tp_name);
- Py_DECREF(ress);
+ res->ob_type->tp_name);
+ Py_DECREF(res);
return NULL;
}
- resu = PyUnicode_FromObject(ress);
- Py_DECREF(ress);
- return resu;
+ return res;
}
}
@@ -413,7 +407,7 @@ _PyObject_Str(PyObject *v)
{
PyObject *res;
if (v == NULL)
- return PyString_FromString("<NULL>");
+ return PyUnicode_FromString("<NULL>");
if (PyString_CheckExact(v)) {
Py_INCREF(v);
return v;