summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--py/obj.h1
-rw-r--r--py/objcell.c11
-rw-r--r--py/objclosure.c8
-rw-r--r--py/objfun.c5
-rw-r--r--windows/mpconfigport.h3
6 files changed, 19 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index ce2e45af97..4c0191f692 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
*.map
*.hex
*.dis
+*.exe
# Packages
############
diff --git a/py/obj.h b/py/obj.h
index 5a3b4a852f..0ecc2fe782 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -511,6 +511,7 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object
bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args,
uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2);
+const char *mp_obj_fun_get_name(mp_obj_t fun);
const char *mp_obj_code_get_name(const byte *code_info);
mp_obj_t mp_identity(mp_obj_t self);
diff --git a/py/objcell.c b/py/objcell.c
index 488a737971..35b44e996d 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -20,14 +20,13 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) {
self->obj = obj;
}
-#if 0
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
mp_obj_cell_t *o = o_in;
- print(env, "<cell ");
+ print(env, "<cell %p ", o->obj);
if (o->obj == MP_OBJ_NULL) {
print(env, "(nil)");
} else {
- //print(env, "%p", o->obj);
mp_obj_print_helper(print, env, o->obj, PRINT_REPR);
}
print(env, ">");
@@ -36,8 +35,10 @@ STATIC void cell_print(void (*print)(void *env, const char *fmt, ...), void *env
const mp_obj_type_t cell_type = {
{ &mp_type_type },
- .name = MP_QSTR_, // should never need to print cell type
- //.print = cell_print,
+ .name = MP_QSTR_, // cell representation is just value in < >
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
+ .print = cell_print,
+#endif
};
mp_obj_t mp_obj_new_cell(mp_obj_t obj) {
diff --git a/py/objclosure.c b/py/objclosure.c
index ca7c537f09..2b83cab71a 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -38,10 +38,10 @@ mp_obj_t closure_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *
}
}
-#if 0
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
STATIC void closure_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind) {
mp_obj_closure_t *o = o_in;
- print(env, "<closure %p, n_closed=%u ", o, o->n_closed);
+ print(env, "<closure %s at %p, n_closed=%u ", mp_obj_fun_get_name(o->fun), o, o->n_closed);
for (int i = 0; i < o->n_closed; i++) {
if (o->closed[i] == MP_OBJ_NULL) {
print(env, "(nil)");
@@ -57,7 +57,9 @@ STATIC void closure_print(void (*print)(void *env, const char *fmt, ...), void *
const mp_obj_type_t closure_type = {
{ &mp_type_type },
.name = MP_QSTR_closure,
- //.print = closure_print,
+#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED
+ .print = closure_print,
+#endif
.call = closure_call,
};
diff --git a/py/objfun.c b/py/objfun.c
index 2855c7452b..4690dc6c88 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -127,8 +127,9 @@ const char *mp_obj_code_get_name(const byte *code_info) {
return qstr_str(block_name);
}
-const char *mp_obj_fun_get_name(mp_obj_fun_bc_t *o) {
- const byte *code_info = o->bytecode;
+const char *mp_obj_fun_get_name(mp_obj_t fun_in) {
+ mp_obj_fun_bc_t *fun = fun_in;
+ const byte *code_info = fun->bytecode;
return mp_obj_code_get_name(code_info);
}
diff --git a/windows/mpconfigport.h b/windows/mpconfigport.h
index 993fef9d59..80d8ac89b5 100644
--- a/windows/mpconfigport.h
+++ b/windows/mpconfigport.h
@@ -12,6 +12,7 @@
#define MICROPY_DEBUG_PRINTERS (1)
#define MICROPY_ENABLE_REPL_HELPERS (1)
#define MICROPY_ENABLE_LEXER_UNIX (1)
+#define MICROPY_MOD_SYS_STDFILES (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
@@ -33,3 +34,5 @@ typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
extern const struct _mp_obj_fun_native_t mp_builtin_open_obj;
+#define MICROPY_EXTRA_BUILTINS \
+ { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj },