diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-06-05 23:54:21 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-06-09 17:33:01 +0300 |
commit | 07241cd37a732e4219257e6b2fc67a84085b37f6 (patch) | |
tree | 7c41bb31dfaffd45e11dd0ed21a52cb145b71542 /py/objstringio.h | |
parent | b24ccfc639416c9427640b5f38e64a1476c1c704 (diff) | |
download | micropython-07241cd37a732e4219257e6b2fc67a84085b37f6.tar.gz micropython-07241cd37a732e4219257e6b2fc67a84085b37f6.zip |
py/objstringio: If created from immutable object, follow copy on write policy.
Don't create copy of immutable object's contents until .write() is called
on BytesIO.
Diffstat (limited to 'py/objstringio.h')
-rw-r--r-- | py/objstringio.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/py/objstringio.h b/py/objstringio.h index 853bfb11b7..56738f4e45 100644 --- a/py/objstringio.h +++ b/py/objstringio.h @@ -33,6 +33,8 @@ typedef struct _mp_obj_stringio_t { vstr_t *vstr; // StringIO has single pointer used for both reading and writing mp_uint_t pos; + // Underlying object buffered by this StringIO + mp_obj_t ref_obj; } mp_obj_stringio_t; #endif // MICROPY_INCLUDED_PY_OBJSTRINGIO_H |