summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2013-08-31 17:18:55 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2013-08-31 17:18:55 (GMT)
commitfb13721b1b48b814dd8efbececfbb1e6c52c1c5d (patch)
tree05bf8cb54ec4ae89548f481b074fea3ab4267bc5 /Objects/unicodeobject.c
parent08548f4a750b6f378c58decdcaf2ac6778103fe1 (diff)
downloadcpython-fb13721b1b48b814dd8efbececfbb1e6c52c1c5d.zip
cpython-fb13721b1b48b814dd8efbececfbb1e6c52c1c5d.tar.gz
cpython-fb13721b1b48b814dd8efbececfbb1e6c52c1c5d.tar.bz2
Close #18780: %-formatting now prints value for int subclasses with %d, %i, and %u codes.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index f1d687a..6dc5835 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13566,11 +13566,9 @@ formatlong(PyObject *val, struct unicode_format_arg_t *arg)
case 'd':
case 'i':
case 'u':
- /* Special-case boolean: we want 0/1 */
- if (PyBool_Check(val))
- result = PyNumber_ToBase(val, 10);
- else
- result = Py_TYPE(val)->tp_str(val);
+ /* int and int subclasses should print numerically when a numeric */
+ /* format code is used (see issue18780) */
+ result = PyNumber_ToBase(val, 10);
break;
case 'o':
numnondigits = 2;