diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-26 10:31:58 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-26 10:31:58 +0100 |
commit | d139c489bab6b58906868e3fc8383ea813a122d4 (patch) | |
tree | 4566ebb0dce5292128e418be74811e34ad8f984f /py/stream.c | |
parent | 6cebe24b7d57432c623625e8eb1a0cb100df369c (diff) | |
parent | e14d096cb7a30b956f6c5b610c6854a6b17d0592 (diff) | |
download | micropython-d139c489bab6b58906868e3fc8383ea813a122d4.tar.gz micropython-d139c489bab6b58906868e3fc8383ea813a122d4.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/stream.c')
-rw-r--r-- | py/stream.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/py/stream.c b/py/stream.c index ba80250216..72e6ab509d 100644 --- a/py/stream.c +++ b/py/stream.c @@ -42,10 +42,11 @@ STATIC mp_obj_t stream_write(mp_obj_t self_in, mp_obj_t arg) { nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported")); } - uint sz; - const char *buf = mp_obj_str_get_data(arg, &sz); + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(arg, &bufinfo, MP_BUFFER_READ); + int error; - machine_int_t out_sz = o->type->stream_p->write(self_in, buf, sz, &error); + machine_int_t out_sz = o->type->stream_p->write(self_in, bufinfo.buf, bufinfo.len, &error); if (out_sz == -1) { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error)); } else { |