]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix my previous commit: bool is a long, restore the specical case for bool
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 27 Apr 2012 22:25:34 +0000 (00:25 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 27 Apr 2012 22:25:34 +0000 (00:25 +0200)
Objects/unicodeobject.c

index ac77114da97bc0a73e28f189bee43ace395d724a..68f11ffa71bc18c7b26eeafc471c3625fc6c904a 100644 (file)
@@ -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;