py/objstr: Applying % (format) operator to bytes should return bytes, not str.

This commit is contained in:
Paul Sokolovsky 2015-12-20 16:50:51 +02:00
parent ef63ab5724
commit d50f649cf8

View File

@ -1484,7 +1484,7 @@ not_enough_args:
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "not all arguments converted during string formatting")); 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 // The implementation is optimized, returning the original string if there's