objstringio: Implement io.BytesIO.

Done in generalized manner, allowing any stream class to be specified as
working with bytes.
This commit is contained in:
Paul Sokolovsky
2014-05-15 07:28:19 +03:00
parent 0c124c3123
commit a47b64ae2d
7 changed files with 46 additions and 11 deletions

View File

@@ -37,8 +37,10 @@ STATIC const mp_map_elem_t mp_module_io_globals_table[] = {
// Note: mp_builtin_open_obj should be defined by port, it's not
// part of the core.
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BytesIO), (mp_obj_t)&mp_type_stringio },
{ MP_OBJ_NEW_QSTR(MP_QSTR_StringIO), (mp_obj_t)&mp_type_stringio },
#if MICROPY_IO_BYTESIO
{ MP_OBJ_NEW_QSTR(MP_QSTR_BytesIO), (mp_obj_t)&mp_type_bytesio },
#endif
};
STATIC const mp_obj_dict_t mp_module_io_globals = {