py/objstr: Support '{:08}'.format("Jan") like Python 3.10.

The new test has an .exp file, because it is not compatible with Python 3.9
and lower.

See CPython version of the issue at https://bugs.python.org/issue27772

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler
2022-01-10 09:03:27 -06:00
committed by Damien George
parent 5e506567a3
commit 037b2c72a1
4 changed files with 15 additions and 2 deletions

View File

@@ -1163,7 +1163,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
s++;
}
if (*s == '0') {
if (!align) {
if (!align && arg_looks_numeric(arg)) {
align = '=';
}
if (!fill) {