diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-20 16:50:51 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-20 16:52:11 +0200 |
commit | d50f649cf8a10c98085f10ef476d43e902458e3c (patch) | |
tree | 1c70c0d9c79521f6d83f201d47d15d9b61b8d80e | |
parent | ef63ab5724dd7c5696ee5c07bf30ac7444df9fb6 (diff) | |
download | micropython-d50f649cf8a10c98085f10ef476d43e902458e3c.tar.gz micropython-d50f649cf8a10c98085f10ef476d43e902458e3c.zip |
py/objstr: Applying % (format) operator to bytes should return bytes, not str.
-rw-r--r-- | py/objstr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objstr.c b/py/objstr.c index fbe61a26f1..7315f40020 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1484,7 +1484,7 @@ not_enough_args: nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "not all arguments converted during string formatting")); } - return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); + return mp_obj_new_str_from_vstr(is_bytes ? &mp_type_bytes : &mp_type_str, &vstr); } // The implementation is optimized, returning the original string if there's |