Skip to content

Commit fbdf2f1

Browse files
committed
py: Rename builtin "io" to "_io".
Functionality we provide in builtin io module is fairly minimal. Some code, including CPython stdlib, depends on more functionality. So, there's a choice to either implement it in C, or move it _io, and let implement other functionality in Python. 2nd choice is pursued. This setup matches CPython too (_io is builtin, io is Python-level).
1 parent 8a0801a commit fbdf2f1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

py/builtintables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
162162

163163
{ MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mp_module_array },
164164
#if MICROPY_PY_IO
165-
{ MP_OBJ_NEW_QSTR(MP_QSTR_io), (mp_obj_t)&mp_module_io },
165+
{ MP_OBJ_NEW_QSTR(MP_QSTR__io), (mp_obj_t)&mp_module_io },
166166
#endif
167167
#if MICROPY_PY_COLLECTIONS
168168
{ MP_OBJ_NEW_QSTR(MP_QSTR__collections), (mp_obj_t)&mp_module_collections },

py/modio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern const mp_obj_type_t mp_type_fileio;
3636
extern const mp_obj_type_t mp_type_textio;
3737

3838
STATIC const mp_map_elem_t mp_module_io_globals_table[] = {
39-
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_io) },
39+
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR__io) },
4040
// Note: mp_builtin_open_obj should be defined by port, it's not
4141
// part of the core.
4242
{ MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },
@@ -65,7 +65,7 @@ STATIC const mp_obj_dict_t mp_module_io_globals = {
6565

6666
const mp_obj_module_t mp_module_io = {
6767
.base = { &mp_type_module },
68-
.name = MP_QSTR_io,
68+
.name = MP_QSTR__io,
6969
.globals = (mp_obj_dict_t*)&mp_module_io_globals,
7070
};
7171

py/qstrdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ Q(unpack)
361361
#endif
362362

363363
#if MICROPY_PY_IO
364-
Q(io)
364+
Q(_io)
365365
Q(readall)
366366
Q(readline)
367367
Q(readlines)

tests/io/stringio1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import io
1+
import _io as io
22

33
a = io.StringIO()
44
print(a.getvalue())

0 commit comments

Comments
 (0)