From b11d91d969d9444b4df3e786c1dbba53da5b3ff0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 28 Apr 2012 00:25:34 +0200 Subject: [PATCH] Fix my previous commit: bool is a long, restore the specical case for bool --- Objects/unicodeobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index ac77114da97..68f11ffa71b 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -13481,7 +13481,10 @@ formatlong(PyObject *val, int flags, int prec, int type) case 'd': case 'u': /* Special-case boolean: we want 0/1 */ - result = Py_TYPE(val)->tp_str(val); + if (PyBool_Check(val)) + result = PyNumber_ToBase(val, 10); + else + result = Py_TYPE(val)->tp_str(val); break; case 'o': numnondigits = 2;