diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-08-10 11:46:10 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-08-10 16:22:48 +0300 |
commit | 7133d91773392f564b6a8d52f09c34cebc975ae3 (patch) | |
tree | cadf81a4c1276d10120964ddd6becc1cf179c581 | |
parent | 5f47ebbf824a5ab6f94a1ac9f8efda9f2a57b008 (diff) | |
download | micropython-7133d91773392f564b6a8d52f09c34cebc975ae3.tar.gz micropython-7133d91773392f564b6a8d52f09c34cebc975ae3.zip |
py: mp_buffer_info_t::buf may be valid, but NULL for empty objects.
This happens for example for zero-size arrays. As .get_buffer() method now
has explicit return value, it's enough to distinguish success vs failure
of getting buffer.
-rw-r--r-- | py/obj.c | 2 | ||||
-rw-r--r-- | py/obj.h | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -410,7 +410,7 @@ bool mp_get_buffer(mp_obj_t obj, mp_buffer_info_t *bufinfo, int flags) { return false; } int ret = type->buffer_p.get_buffer(obj, bufinfo, flags); - if (ret != 0 || bufinfo->buf == NULL) { + if (ret != 0) { return false; } return true; @@ -210,7 +210,7 @@ typedef struct _mp_buffer_info_t { // them with ver = sizeof(struct). Cons: overkill for *micro*? //int ver; // ? - void *buf; + void *buf; // can be NULL if len == 0 mp_int_t len; // in bytes int typecode; // as per binary.h |