Kaydet (Commit) b03ccc04 authored tarafından Walter Dörwald's avatar Walter Dörwald

Simplify PyObject_Unicode(NULL) by using

PyUnicode_FromString().
üst 0368b726
...@@ -435,14 +435,9 @@ PyObject_Unicode(PyObject *v) ...@@ -435,14 +435,9 @@ PyObject_Unicode(PyObject *v)
PyObject *str; PyObject *str;
static PyObject *unicodestr; static PyObject *unicodestr;
if (v == NULL) { if (v == NULL)
res = PyString_FromString("<NULL>"); return PyUnicode_FromString("<NULL>");
if (res == NULL) else if (PyUnicode_CheckExact(v)) {
return NULL;
str = PyUnicode_FromEncodedObject(res, NULL, "strict");
Py_DECREF(res);
return str;
} else if (PyUnicode_CheckExact(v)) {
Py_INCREF(v); Py_INCREF(v);
return v; return v;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment