diff options
| author | Tony DiCola <tony@tonydicola.com> | 2016-10-20 23:01:13 +0000 |
|---|---|---|
| committer | Tony DiCola <tony@tonydicola.com> | 2016-10-20 23:01:13 +0000 |
| commit | 00a44fa36cd1e35a438c4b89b5cef0bc82787c7a (patch) | |
| tree | 4800a6984902e043e3fc437adcdfcd665f83e220 /py/objstringio.c | |
| parent | 1f13f870b8f6554d9cd5570de221a6886e065b64 (diff) | |
| parent | 3967ca7390ff8257728ef6237b93977b63bde41d (diff) | |
Merge remote-tracking branch 'micropython/master'
Conflicts:
README.md - Kept Adafruit README.md intact.
py/emitglue.c - Added xtensa architecture as an OR of the define.
zephyr/README.md - Fixed spelling mistake.
Diffstat (limited to 'py/objstringio.c')
| -rw-r--r-- | py/objstringio.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/py/objstringio.c b/py/objstringio.c index eb0cc4eb3..a430fca3b 100644 --- a/py/objstringio.c +++ b/py/objstringio.c @@ -30,22 +30,16 @@ #include "py/nlr.h" #include "py/objstr.h" +#include "py/objstringio.h" #include "py/runtime.h" #include "py/stream.h" #if MICROPY_PY_IO -typedef struct _mp_obj_stringio_t { - mp_obj_base_t base; - vstr_t *vstr; - // StringIO has single pointer used for both reading and writing - mp_uint_t pos; -} mp_obj_stringio_t; - #if MICROPY_CPYTHON_COMPAT STATIC void check_stringio_is_open(const mp_obj_stringio_t *o) { if (o->vstr == NULL) { - nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "I/O operation on closed file")); + mp_raise_msg(&mp_type_ValueError, "I/O operation on closed file"); } } #else @@ -156,7 +150,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stringio___exit___obj, 4, 4, stringio STATIC mp_obj_stringio_t *stringio_new(const mp_obj_type_t *type) { mp_obj_stringio_t *o = m_new_obj(mp_obj_stringio_t); o->base.type = type; - o->vstr = vstr_new(); + o->vstr = vstr_new(16); o->pos = 0; return o; } |
