From 2fe4cf7761ffc40d81b4780d59c2b6ef0a5c16ff Mon Sep 17 00:00:00 2001 From: stijn Date: Sat, 4 Oct 2014 08:51:33 +0200 Subject: Implement kwargs for builtin open() and _io.FileIO This makes open() and _io.FileIO() more CPython compliant. The mode kwarg is fully iplemented. The encoding kwarg is allowed but not implemented; mainly to allow the tests to specify encoding for CPython, see #874 --- py/builtin.h | 2 +- py/qstrdefs.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'py') diff --git a/py/builtin.h b/py/builtin.h index 01ec22d2b..a69712bec 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -25,7 +25,7 @@ */ mp_obj_t mp_builtin___import__(mp_uint_t n_args, mp_obj_t *args); -mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args); +mp_obj_t mp_builtin_open(mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kwargs); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___build_class___obj); MP_DECLARE_CONST_FUN_OBJ(mp_builtin___import___obj); diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 2c2c45b5b..c10b2faba 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -446,6 +446,9 @@ Q(StringIO) Q(BytesIO) Q(getvalue) Q(file) +Q(mode) +Q(r) +Q(encoding) #endif #if MICROPY_PY_GC -- cgit v1.2.3