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 --- unix/modsocket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'unix/modsocket.c') diff --git a/unix/modsocket.c b/unix/modsocket.c index 7f9184db6..82d833653 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -257,7 +257,9 @@ STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) { mp_obj_t *new_args = alloca(n_args * sizeof(mp_obj_t)); memcpy(new_args + 1, args + 1, (n_args - 1) * sizeof(mp_obj_t)); new_args[0] = MP_OBJ_NEW_SMALL_INT(self->fd); - return mp_builtin_open(n_args, new_args); + mp_map_t kwargs; + mp_map_init(&kwargs, 0); + return mp_builtin_open(n_args, new_args, &kwargs); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile); -- cgit v1.2.3