Add functions PyUnicode_Append() and PyUnicode_AppendAndDel() that mirror
PyString_Concat() and PyString_ConcatAndDel() (the name PyUnicode_Concat()
was already taken).

Change PyObject_Repr() to always return a unicode object.

Update all repr implementations to return unicode objects.

Add a function PyObject_ReprStr8() that calls PyObject_Repr() and converts
the result to an 8bit string.

Use PyObject_ReprStr8() where using PyObject_Repr() can't be done
straightforward.
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 2960665..1311d4d 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -611,14 +611,14 @@
 static PyObject *
 deque_repr(PyObject *deque)
 {
-	PyObject *aslist, *result, *fmt;
+	PyObject *aslist, *result;
 	int i;
 
 	i = Py_ReprEnter(deque);
 	if (i != 0) {
 		if (i < 0)
 			return NULL;
-		return PyString_FromString("[...]");
+		return PyUnicode_FromString("[...]");
 	}
 
 	aslist = PySequence_List(deque);
@@ -627,14 +627,14 @@
 		return NULL;
 	}
 
-	fmt = PyString_FromString("deque(%r)");
-	if (fmt == NULL) {
+	result = PyUnicode_FromString("deque(");
+	if (result == NULL) {
 		Py_DECREF(aslist);
 		Py_ReprLeave(deque);
 		return NULL;
 	}
-	result = PyString_Format(fmt, aslist);
-	Py_DECREF(fmt);
+	PyUnicode_AppendAndDel(&result, PyObject_Repr(aslist));
+	PyUnicode_AppendAndDel(&result, PyUnicode_FromString(")"));
 	Py_DECREF(aslist);
 	Py_ReprLeave(deque);
 	return result;
@@ -1215,18 +1215,18 @@
 	if (baserepr == NULL)
 		return NULL;
 	if (dd->default_factory == NULL)
-		defrepr = PyString_FromString("None");
+		defrepr = PyUnicode_FromString("None");
 	else
 		defrepr = PyObject_Repr(dd->default_factory);
 	if (defrepr == NULL) {
 		Py_DECREF(baserepr);
 		return NULL;
 	}
-	result = PyString_FromFormat("defaultdict(%s, %s)",
-				     PyString_AS_STRING(defrepr),
-				     PyString_AS_STRING(baserepr));
-	Py_DECREF(defrepr);
-	Py_DECREF(baserepr);
+	result = PyUnicode_FromString("defaultdict(");
+	PyUnicode_AppendAndDel(&result, defrepr);
+	PyUnicode_AppendAndDel(&result, PyUnicode_FromString(", "));
+	PyUnicode_AppendAndDel(&result, baserepr);
+	PyUnicode_AppendAndDel(&result, PyUnicode_FromString(")"));
 	return result;
 }