Format bools properly in %d.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 7a35974..b1d711d 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -4144,11 +4144,14 @@
 		return NULL;
 	}
 
-
 	switch (type) {
 	case 'd':
 	case 'u':
-		result = Py_Type(val)->tp_str(val);
+		/* Special-case boolean: we want 0/1 */
+		if (PyBool_Check(val))
+			result = PyNumber_ToBase(val, 10);
+		else
+			result = Py_Type(val)->tp_str(val);
 		break;
 	case 'o':
 		numnondigits = 2;