summaryrefslogtreecommitdiff
path: root/stm/main.c
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-07 18:01:08 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-07 18:01:08 +0000
commit270112f7312f724e46ae34649dfce3ec43b697e0 (patch)
treed7438ae877350aede062d8ac7e62e52ab35cb018 /stm/main.c
parentc06763a0207dde7f2060f7b1670a0b99298a01f8 (diff)
parentfd04bb3bacf5dbc4d79c04a49520e3e81abb7352 (diff)
Merge remote-tracking branch 'upstream/master' into listsort. Lots of conflict fun.
Conflicts: py/obj.h py/objbool.c py/objboundmeth.c py/objcell.c py/objclass.c py/objclosure.c py/objcomplex.c py/objdict.c py/objexcept.c py/objfun.c py/objgenerator.c py/objinstance.c py/objmodule.c py/objrange.c py/objset.c py/objslice.c
Diffstat (limited to 'stm/main.c')
-rw-r--r--stm/main.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/stm/main.c b/stm/main.c
index 07c974eff..a038c89b7 100644
--- a/stm/main.c
+++ b/stm/main.c
@@ -689,22 +689,18 @@ static MP_DEFINE_CONST_FUN_OBJ_1(file_obj_close_obj, file_obj_close);
// TODO gc hook to close the file if not already closed
+static const mp_method_t file_methods[] = {
+ { "read", &file_obj_read_obj },
+ { "write", &file_obj_write_obj },
+ { "close", &file_obj_close_obj },
+ {NULL, NULL},
+};
+
static const mp_obj_type_t file_obj_type = {
{ &mp_const_type },
"File",
- file_obj_print, // print
- NULL, // make_new
- NULL, // call_n
- NULL, // unary_op
- NULL, // binary_op
- NULL, // getiter
- NULL, // iternext
- .methods = {
- { "read", &file_obj_read_obj },
- { "write", &file_obj_write_obj },
- { "close", &file_obj_close_obj },
- {NULL, NULL},
- }
+ .print = file_obj_print,
+ .methods = file_methods,
};
mp_obj_t pyb_io_open(mp_obj_t o_filename, mp_obj_t o_mode) {