diff options
author | Damien George <damien.p.george@gmail.com> | 2016-05-07 21:18:17 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-05-07 21:18:17 +0100 |
commit | 12dd8df3756d58af2f4d1f54eefd90f1ce1e0dbe (patch) | |
tree | 1a68d55f561fcda2b4ee814707d9cc6c43495142 /py/objstr.c | |
parent | 2724bd4a94a3f75427bc2a287c88cbca69c49124 (diff) | |
download | micropython-12dd8df3756d58af2f4d1f54eefd90f1ce1e0dbe.tar.gz micropython-12dd8df3756d58af2f4d1f54eefd90f1ce1e0dbe.zip |
py/objstr: Binary type of str/bytes for buffer protocol is 'B'.
The type is an unsigned 8-bit value, since bytes objects are exactly
that. And it's also sensible for unicode strings to return unsigned
values when accessed in a byte-wise manner (CPython does not allow this).
Diffstat (limited to 'py/objstr.c')
-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 d0d090b995..3d3845f4a4 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1806,7 +1806,7 @@ mp_int_t mp_obj_str_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_u GET_STR_DATA_LEN(self_in, str_data, str_len); bufinfo->buf = (void*)str_data; bufinfo->len = str_len; - bufinfo->typecode = 'b'; + bufinfo->typecode = 'B'; // bytes should be unsigned, so should unicode byte-access return 0; } else { // can't write to a string |