This patch adds a new builtin unistr() which behaves like str()
except that it always returns Unicode objects.
A new C API PyObject_Unicode() is also provided.
This closes patch #101664.
Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a3678d5..c1f3d54 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -413,6 +413,7 @@
}
else
v = PyUnicode_Decode(s, len, encoding, errors);
+
done:
if (owned) {
Py_DECREF(obj);