Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 42594:ac5ce7c43ee7
Format bools properly in %d.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Tue, 14 Aug 2007 21:57:32 +0000 |
| parents | e7fd327e0c19 |
| children | 85c22b4d4455 |
line wrap: on
line diff
--- a/Objects/stringobject.c Tue Aug 14 17:53:54 2007 +0000 +++ b/Objects/stringobject.c Tue Aug 14 21:57:32 2007 +0000 @@ -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;
