summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/objstringio.c1
-rw-r--r--tests/basics/io_stringio1.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/py/objstringio.c b/py/objstringio.c
index 98808e3a95..1766913872 100644
--- a/py/objstringio.c
+++ b/py/objstringio.c
@@ -228,6 +228,7 @@ STATIC const mp_rom_map_elem_t stringio_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_seek), MP_ROM_PTR(&mp_stream_seek_obj) },
+ { MP_ROM_QSTR(MP_QSTR_tell), MP_ROM_PTR(&mp_stream_tell_obj) },
{ MP_ROM_QSTR(MP_QSTR_flush), MP_ROM_PTR(&mp_stream_flush_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
{ MP_ROM_QSTR(MP_QSTR_getvalue), MP_ROM_PTR(&stringio_getvalue_obj) },
diff --git a/tests/basics/io_stringio1.py b/tests/basics/io_stringio1.py
index 9f7c1e44ef..41089f22d5 100644
--- a/tests/basics/io_stringio1.py
+++ b/tests/basics/io_stringio1.py
@@ -34,6 +34,11 @@ a.write("foo")
print(a.read())
a = io.StringIO()
+print(a.tell())
+a.write("foo")
+print(a.tell())
+
+a = io.StringIO()
a.close()
for f in [a.read, a.getvalue, lambda:a.write("")]:
# CPython throws for operations on closed I/O, MicroPython makes