Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b11d91d

Browse files
committed
Fix my previous commit: bool is a long, restore the specical case for bool
1 parent 92ff4e1 commit b11d91d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Objects/unicodeobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13481,7 +13481,10 @@ formatlong(PyObject *val, int flags, int prec, int type)
1348113481
case 'd':
1348213482
case 'u':
1348313483
/* Special-case boolean: we want 0/1 */
13484-
result = Py_TYPE(val)->tp_str(val);
13484+
if (PyBool_Check(val))
13485+
result = PyNumber_ToBase(val, 10);
13486+
else
13487+
result = Py_TYPE(val)->tp_str(val);
1348513488
break;
1348613489
case 'o':
1348713490
numnondigits = 2;

0 commit comments

Comments
 (0)