38 #if MICROPY_CPYTHON_COMPAT 45 #define check_stringio_is_open(o) 57 check_stringio_is_open(o);
62 if (size > remaining) {
81 check_stringio_is_open(o);
84 stringio_copy_on_write(o);
101 if (o->
pos > org_len) {
136 }
else if (new_pos < ref) {
152 #define STREAM_TO_CONTENT_TYPE(o) (((o)->base.type == &mp_type_stringio) ? &mp_type_str : &mp_type_bytes) 156 check_stringio_is_open(
self);
164 #if MICROPY_CPYTHON_COMPAT 169 self->vstr->alloc = 0;
179 return stringio_close(
args[0]);
195 bool initdata =
false;
245 .
read = stringio_read,
246 .write = stringio_write,
247 .ioctl = stringio_ioctl,
252 .
read = stringio_read,
253 .write = stringio_write,
254 .ioctl = stringio_ioctl,
259 .
name = MP_QSTR_StringIO,
260 .print = stringio_print,
261 .make_new = stringio_make_new,
264 .protocol = &stringio_stream_p,
268 #if MICROPY_PY_IO_BYTESIO 271 .
name = MP_QSTR_BytesIO,
272 .print = stringio_print,
273 .make_new = stringio_make_new,
276 .protocol = &bytesio_stream_p,
void vstr_init_fixed_buf(vstr_t *vstr, size_t alloc, char *buf)
void * memset(void *b, int c, size_t len)
#define MP_DEFINE_CONST_DICT(dict_name, table_name)
mp_uint_t(* read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode)
vstr_t * vstr_new(size_t alloc)
#define MP_OBJ_FROM_PTR(p)
mp_int_t mp_obj_get_int(mp_const_obj_t arg)
mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self)
char * vstr_add_len(vstr_t *vstr, size_t len)
const mp_obj_type_t mp_type_stringio
#define MP_DEFINE_CONST_FUN_OBJ_1(obj_name, fun_name)
#define MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(obj_name, n_args_min, n_args_max, fun_name)
const mp_obj_type_t mp_type_type
NORETURN void mp_raise_ValueError(const char *msg)
mp_obj_t mp_identity_getiter(mp_obj_t self, mp_obj_iter_buf_t *iter_buf)
void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flags)
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte *data, size_t len)
void vstr_free(vstr_t *vstr)
const mp_obj_type_t mp_type_bytesio
int mp_printf(const mp_print_t *print, const char *fmt,...)
#define MP_OBJ_IS_STR_OR_BYTES(o)
void vstr_clear(vstr_t *vstr)
void * memcpy(void *dst, const void *src, size_t n)