'')
self.assertEqual("{[{}]}".format({"{}": 5}), "5")
+ self.assertEqual("0x{:0{:d}X}".format(0x0,16), "0x0000000000000000")
def test_format_map(self):
self.assertEqual(''.format_map({}), '')
Core and Builtins
-----------------
+- Issue #19729: In str.format(), fix recursive expansion in format spec.
+
- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2
billion characters) input strings in _Py_dg_strtod.
while (self->str.start < self->str.end) {
switch (c = PyUnicode_READ_CHAR(self->str.str, self->str.start++)) {
case ':':
- hit_format_spec = 1;
- count = 1;
+ if (!hit_format_spec) {
+ count = 1;
+ hit_format_spec = 1;
+ }
break;
case '{':
/* the format spec needs to be recursively expanded.