diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-05-09 23:42:42 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-05-09 23:42:42 +0300 |
commit | 40f0096ee7b367491248ae5fae093246e0a1a044 (patch) | |
tree | d5a7c9e8d7e3fcd956c893056d00f2f62815e81b /py | |
parent | a1f2245a81cb9e99cc620797e54a003bf0907b16 (diff) | |
download | micropython-40f0096ee7b367491248ae5fae093246e0a1a044.tar.gz micropython-40f0096ee7b367491248ae5fae093246e0a1a044.zip |
Revert "py/objstr: .format(): Avoid call to vstr_null_terminated_str()."
This reverts commit 6de8dbb4880e58c68a08205cb2b9c15940143439. The change
was incorrect (correct change would require comparing with end pointer in
each if statement in the block).
Diffstat (limited to 'py')
-rw-r--r-- | py/objstr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c index 4c0984c38c..3d3845f4a4 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1043,7 +1043,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar // recursively call the formatter to format any nested specifiers MP_STACK_CHECK(); vstr_t format_spec_vstr = mp_obj_str_format_helper(format_spec, str, arg_i, n_args, args, kwargs); - const char *s = format_spec_vstr.buf; + const char *s = vstr_null_terminated_str(&format_spec_vstr); const char *stop = s + format_spec_vstr.len; if (isalignment(*s)) { align = *s++; @@ -1083,7 +1083,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar if (istype(*s)) { type = *s++; } - if (s != stop) { + if (*s) { if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { terse_str_format_value_error(); } else { |