summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/file.c3
-rw-r--r--stmhal/malloc0.c3
-rw-r--r--stmhal/mpconfigport.h1
3 files changed, 5 insertions, 2 deletions
diff --git a/stmhal/file.c b/stmhal/file.c
index a66b59b29d..a78c58d4f9 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -53,6 +53,7 @@ STATIC const mp_map_elem_t file_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&file_obj_close_obj },
+ { MP_OBJ_NEW_QSTR(MP_QSTR___del__), (mp_obj_t)&file_obj_close_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR___enter__), (mp_obj_t)&mp_identity_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR___exit__), (mp_obj_t)&file_obj___exit___obj },
};
@@ -81,7 +82,7 @@ STATIC mp_obj_t file_obj_make_new(mp_obj_t type_in, uint n_args, uint n_kw, cons
if (n_args > 1) {
mode = mp_obj_str_get_str(args[1]);
}
- pyb_file_obj_t *self = m_new_obj(pyb_file_obj_t);
+ pyb_file_obj_t *self = m_new_obj_with_finaliser(pyb_file_obj_t);
self->base.type = &file_obj_type;
if (mode[0] == 'r') {
// open for reading
diff --git a/stmhal/malloc0.c b/stmhal/malloc0.c
index 85a643f72d..510fa0d740 100644
--- a/stmhal/malloc0.c
+++ b/stmhal/malloc0.c
@@ -1,5 +1,6 @@
+#include <stdio.h>
#include <stdint.h>
-#include "std.h"
+#include "misc.h"
#include "mpconfig.h"
#include "gc.h"
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index b187c43bbe..0bb11cae5a 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -5,6 +5,7 @@
#define MICROPY_EMIT_THUMB (1)
#define MICROPY_EMIT_INLINE_THUMB (1)
#define MICROPY_ENABLE_GC (1)
+#define MICROPY_ENABLE_FINALISER (1)
#define MICROPY_ENABLE_REPL_HELPERS (1)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)