aboutsummaryrefslogtreecommitdiff
path: root/stm
diff options
context:
space:
mode:
authorDamien George2014-04-05 20:35:48 +0100
committerDamien George2014-04-05 20:35:48 +0100
commit12bab72d93498958ddef26c1a2dd7c69a9f9cf8d (patch)
tree7415b5201b6dca0daf60a9968543b398fab49baa /stm
parent8123a3339dc7381a079afa90649ce140075eb2e2 (diff)
Improve GC finalisation code; add option to disable it.
Diffstat (limited to 'stm')
-rw-r--r--stm/file.c2
-rw-r--r--stm/malloc0.c3
-rw-r--r--stm/mpconfigport.h1
3 files changed, 4 insertions, 2 deletions
diff --git a/stm/file.c b/stm/file.c
index 8abb45b4e..44210d59d 100644
--- a/stm/file.c
+++ b/stm/file.c
@@ -71,7 +71,7 @@ static const mp_obj_type_t file_obj_type = {
mp_obj_t pyb_io_open(mp_obj_t o_filename, mp_obj_t o_mode) {
const char *filename = mp_obj_str_get_str(o_filename);
const char *mode = mp_obj_str_get_str(o_mode);
- pyb_file_obj_t *self = m_new_mp_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/stm/malloc0.c b/stm/malloc0.c
index 85a643f72..510fa0d74 100644
--- a/stm/malloc0.c
+++ b/stm/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/stm/mpconfigport.h b/stm/mpconfigport.h
index 4c8338be5..c832f4388 100644
--- a/stm/mpconfigport.h
+++ b/stm/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)