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).
This commit is contained in:
parent
8a0801ad24
commit
fbdf2f1d63
@ -162,7 +162,7 @@ STATIC const mp_map_elem_t mp_builtin_module_table[] = {
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_array), (mp_obj_t)&mp_module_array },
|
||||
#if MICROPY_PY_IO
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_io), (mp_obj_t)&mp_module_io },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR__io), (mp_obj_t)&mp_module_io },
|
||||
#endif
|
||||
#if MICROPY_PY_COLLECTIONS
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR__collections), (mp_obj_t)&mp_module_collections },
|
||||
|
@ -36,7 +36,7 @@ extern const mp_obj_type_t mp_type_fileio;
|
||||
extern const mp_obj_type_t mp_type_textio;
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_io_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_io) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR__io) },
|
||||
// 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 },
|
||||
@ -65,7 +65,7 @@ STATIC const mp_obj_dict_t mp_module_io_globals = {
|
||||
|
||||
const mp_obj_module_t mp_module_io = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_io,
|
||||
.name = MP_QSTR__io,
|
||||
.globals = (mp_obj_dict_t*)&mp_module_io_globals,
|
||||
};
|
||||
|
||||
|
@ -361,7 +361,7 @@ Q(unpack)
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_IO
|
||||
Q(io)
|
||||
Q(_io)
|
||||
Q(readall)
|
||||
Q(readline)
|
||||
Q(readlines)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import io
|
||||
import _io as io
|
||||
|
||||
a = io.StringIO()
|
||||
print(a.getvalue())
|
||||
|
Loading…
Reference in New Issue
Block a user