summaryrefslogtreecommitdiff
path: root/unix/modsocket.c
diff options
context:
space:
mode:
authorstijn <stinos@zoho.com>2014-10-04 08:51:33 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-10-21 22:10:01 +0300
commit2fe4cf7761ffc40d81b4780d59c2b6ef0a5c16ff (patch)
treea959cd20a8f4458861a3589f9d179225609ffc19 /unix/modsocket.c
parent072bd07f178998f2c88cd2ceef86dea7902a1764 (diff)
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
Diffstat (limited to 'unix/modsocket.c')
-rw-r--r--unix/modsocket.c4
1 files changed, 3 insertions, 1 deletions
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);