[python] upgrade to micropython 1.12

This commit is contained in:
Émilie Feral
2020-04-06 14:57:17 +02:00
committed by LeaNumworks
parent 010fb1894f
commit 7df8c2935a
83 changed files with 3516 additions and 1284 deletions

View File

@@ -31,6 +31,7 @@
#include "py/runtime.h"
#include "py/builtin.h"
#include "py/objtype.h"
#include "py/objstr.h"
#define mp_obj_is_dict_type(o) (mp_obj_is_obj(o) && ((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->make_new == dict_make_new)
@@ -59,7 +60,7 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_
if (!(MICROPY_PY_UJSON && kind == PRINT_JSON)) {
kind = PRINT_REPR;
}
if (MICROPY_PY_COLLECTIONS_ORDEREDDICT && self->base.type != &mp_type_dict) {
if (MICROPY_PY_COLLECTIONS_ORDEREDDICT && self->base.type != &mp_type_dict && kind != PRINT_JSON) {
mp_printf(print, "%q(", self->base.type->name);
}
mp_print_str(print, "{");
@@ -70,12 +71,19 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_
mp_print_str(print, ", ");
}
first = false;
bool add_quote = MICROPY_PY_UJSON && kind == PRINT_JSON && !mp_obj_is_str_or_bytes(next->key);
if (add_quote) {
mp_print_str(print, "\"");
}
mp_obj_print_helper(print, next->key, kind);
if (add_quote) {
mp_print_str(print, "\"");
}
mp_print_str(print, ": ");
mp_obj_print_helper(print, next->value, kind);
}
mp_print_str(print, "}");
if (MICROPY_PY_COLLECTIONS_ORDEREDDICT && self->base.type != &mp_type_dict) {
if (MICROPY_PY_COLLECTIONS_ORDEREDDICT && self->base.type != &mp_type_dict && kind != PRINT_JSON) {
mp_print_str(print, ")");
}
}