summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/makeqstrdata.py3
-rw-r--r--py/obj.c8
-rw-r--r--py/obj.h16
-rw-r--r--py/objarray.c4
-rw-r--r--py/objbool.c2
-rw-r--r--py/objboundmeth.c2
-rw-r--r--py/objcell.c2
-rw-r--r--py/objclosure.c2
-rw-r--r--py/objcomplex.c2
-rw-r--r--py/objdict.c8
-rw-r--r--py/objenumerate.c2
-rw-r--r--py/objexcept.c2
-rw-r--r--py/objfilter.c2
-rw-r--r--py/objfloat.c2
-rw-r--r--py/objfun.c6
-rw-r--r--py/objgenerator.c4
-rw-r--r--py/objgetitemiter.c2
-rw-r--r--py/objint.c2
-rw-r--r--py/objlist.c4
-rw-r--r--py/objmap.c2
-rw-r--r--py/objmodule.c2
-rw-r--r--py/objnone.c2
-rw-r--r--py/objrange.c4
-rw-r--r--py/objset.c4
-rw-r--r--py/objslice.c4
-rw-r--r--py/objstr.c8
-rw-r--r--py/objtuple.c4
-rw-r--r--py/objtype.c16
-rw-r--r--py/objzip.c2
-rw-r--r--py/qstrdefs.h11
30 files changed, 74 insertions, 60 deletions
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index c5ad708e89..f231a5d861 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -8,6 +8,9 @@ if platform.python_version_tuple()[0] == '2':
elif platform.python_version_tuple()[0] == '3':
from html.entities import codepoint2name
+# add some custom names to map characters that aren't in HTML
+codepoint2name[ord('.')] = 'dot'
+
# this must match the equivalent function in qstr.c
def compute_hash(qstr):
hash = 0
diff --git a/py/obj.c b/py/obj.c
index 4e0184a5f0..86c0edc15b 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -26,7 +26,7 @@ mp_obj_type_t *mp_obj_get_type(mp_obj_t o_in) {
}
const char *mp_obj_get_type_str(mp_obj_t o_in) {
- return mp_obj_get_type(o_in)->name;
+ return qstr_str(mp_obj_get_type(o_in)->name);
}
void printf_wrapper(void *env, const char *fmt, ...) {
@@ -41,7 +41,7 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e
if (type->print != NULL) {
type->print(print, env, o_in, kind);
} else {
- print(env, "<%s>", type->name);
+ print(env, "<%s>", qstr_str(type->name));
}
}
@@ -226,11 +226,11 @@ uint mp_get_index(const mp_obj_type_t *type, machine_uint_t len, mp_obj_t index)
i += len;
}
if (i < 0 || i >= len) {
- nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_IndexError, "%s index out of range", type->name));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_IndexError, "%s index out of range", qstr_str(type->name)));
}
return i;
} else {
- nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "%s indices must be integers, not %s", type->name, mp_obj_get_type_str(index)));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "%s indices must be integers, not %s", qstr_str(type->name), mp_obj_get_type_str(index)));
}
}
diff --git a/py/obj.h b/py/obj.h
index 4982d5bc23..bed119c0a2 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -142,7 +142,7 @@ typedef struct _mp_stream_p_t {
struct _mp_obj_type_t {
mp_obj_base_t base;
- const char *name;
+ qstr name;
mp_print_fun_t print;
mp_make_new_fun_t make_new; // to make an instance of the type
@@ -150,6 +150,12 @@ struct _mp_obj_type_t {
mp_unary_op_fun_t unary_op; // can return NULL if op not supported
mp_binary_op_fun_t binary_op; // can return NULL if op not supported
+ mp_load_attr_fun_t load_attr;
+ mp_store_attr_fun_t store_attr;
+ // Implements container[index] = val; note that load_item is implemented
+ // by binary_op(RT_BINARY_OP_SUBSCR)
+ mp_store_item_fun_t store_item;
+
mp_fun_1_t getiter;
mp_fun_1_t iternext;
@@ -161,12 +167,6 @@ struct _mp_obj_type_t {
const mp_method_t *methods;
- mp_load_attr_fun_t load_attr;
- mp_store_attr_fun_t store_attr;
- // Implements container[index] = val; note that load_item is implemented
- // by binary_op(RT_BINARY_OP_SUBSCR)
- mp_store_item_fun_t store_item;
-
// these are for dynamically created types (classes)
mp_obj_t bases_tuple;
mp_obj_t locals_dict;
@@ -200,7 +200,7 @@ extern const mp_obj_t mp_const_stop_iteration; // special object indicating end
// General API for objects
-mp_obj_t mp_obj_new_type(const char *name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
+mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
mp_obj_t mp_obj_new_none(void);
mp_obj_t mp_obj_new_bool(bool value);
mp_obj_t mp_obj_new_cell(mp_obj_t obj);
diff --git a/py/objarray.c b/py/objarray.c
index d1bc08b150..4a70f9f7f5 100644
--- a/py/objarray.c
+++ b/py/objarray.c
@@ -161,7 +161,7 @@ STATIC const mp_method_t array_type_methods[] = {
const mp_obj_type_t array_type = {
{ &mp_const_type },
- "array",
+ .name = MP_QSTR_array,
.print = array_print,
.make_new = array_make_new,
.getiter = array_iterator_new,
@@ -223,7 +223,7 @@ mp_obj_t array_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t array_it_type = {
{ &mp_const_type },
- "array_iterator",
+ .name = MP_QSTR_iterator,
.iternext = array_it_iternext,
};
diff --git a/py/objbool.c b/py/objbool.c
index fb38bdfb00..2dd019b720 100644
--- a/py/objbool.c
+++ b/py/objbool.c
@@ -47,7 +47,7 @@ STATIC mp_obj_t bool_unary_op(int op, mp_obj_t o_in) {
const mp_obj_type_t bool_type = {
{ &mp_const_type },
- "bool",
+ .name = MP_QSTR_bool,
.print = bool_print,
.make_new = bool_make_new,
.unary_op = bool_unary_op,
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index 500e61bd53..72fbc233f1 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -41,7 +41,7 @@ mp_obj_t bound_meth_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_
const mp_obj_type_t bound_meth_type = {
{ &mp_const_type },
- "bound_method",
+ .name = MP_QSTR_bound_method,
.call = bound_meth_call,
};
diff --git a/py/objcell.c b/py/objcell.c
index 04c7f36851..ce8f360141 100644
--- a/py/objcell.c
+++ b/py/objcell.c
@@ -26,7 +26,7 @@ void mp_obj_cell_set(mp_obj_t self_in, mp_obj_t obj) {
const mp_obj_type_t cell_type = {
{ &mp_const_type },
- "cell",
+ .name = MP_QSTR_, // should never need to print cell type
};
mp_obj_t mp_obj_new_cell(mp_obj_t obj) {
diff --git a/py/objclosure.c b/py/objclosure.c
index 0f4816e5fd..39e38c9d27 100644
--- a/py/objclosure.c
+++ b/py/objclosure.c
@@ -42,7 +42,7 @@ mp_obj_t closure_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *
const mp_obj_type_t closure_type = {
{ &mp_const_type },
- "closure",
+ .name = MP_QSTR_closure,
.call = closure_call,
};
diff --git a/py/objcomplex.c b/py/objcomplex.c
index e3dce365f5..3b5de03ed3 100644
--- a/py/objcomplex.c
+++ b/py/objcomplex.c
@@ -87,7 +87,7 @@ STATIC mp_obj_t complex_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
const mp_obj_type_t complex_type = {
{ &mp_const_type },
- "complex",
+ .name = MP_QSTR_complex,
.print = complex_print,
.make_new = complex_make_new,
.unary_op = complex_unary_op,
diff --git a/py/objdict.c b/py/objdict.c
index 3f1b2087f3..15e738dff1 100644
--- a/py/objdict.c
+++ b/py/objdict.c
@@ -113,7 +113,7 @@ mp_obj_t dict_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t dict_it_type = {
{ &mp_const_type },
- "dict_iterator",
+ .name = MP_QSTR_iterator,
.iternext = dict_it_iternext,
};
@@ -342,7 +342,7 @@ STATIC mp_obj_t dict_view_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t dict_view_it_type = {
{ &mp_const_type },
- "dict_view_iterator",
+ .name = MP_QSTR_iterator,
.iternext = dict_view_it_iternext,
.methods = NULL, /* set operations still to come */
};
@@ -386,7 +386,7 @@ STATIC mp_obj_t dict_view_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
STATIC const mp_obj_type_t dict_view_type = {
{ &mp_const_type },
- "dict_view",
+ .name = MP_QSTR_dict_view,
.print = dict_view_print,
.binary_op = dict_view_binary_op,
.getiter = dict_view_getiter,
@@ -441,7 +441,7 @@ STATIC const mp_method_t dict_type_methods[] = {
const mp_obj_type_t dict_type = {
{ &mp_const_type },
- "dict",
+ .name = MP_QSTR_dict,
.print = dict_print,
.make_new = dict_make_new,
.unary_op = dict_unary_op,
diff --git a/py/objenumerate.c b/py/objenumerate.c
index e7695a16bd..2ca4dcd775 100644
--- a/py/objenumerate.c
+++ b/py/objenumerate.c
@@ -28,7 +28,7 @@ STATIC mp_obj_t enumerate_make_new(mp_obj_t type_in, uint n_args, uint n_kw, con
const mp_obj_type_t enumerate_type = {
{ &mp_const_type },
- "enumerate",
+ .name = MP_QSTR_enumerate,
.make_new = enumerate_make_new,
.iternext = enumerate_iternext,
.getiter = mp_identity,
diff --git a/py/objexcept.c b/py/objexcept.c
index 48d3de841e..e2c154de97 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -63,7 +63,7 @@ STATIC mp_obj_t exception_call(mp_obj_t self_in, uint n_args, uint n_kw, const m
const mp_obj_type_t exception_type = {
{ &mp_const_type },
- "exception",
+ .name = MP_QSTR_, // TODO proper exception names
.print = exception_print,
.call = exception_call,
};
diff --git a/py/objfilter.c b/py/objfilter.c
index 6d7abcf6f4..4dde7fac8c 100644
--- a/py/objfilter.c
+++ b/py/objfilter.c
@@ -46,7 +46,7 @@ STATIC mp_obj_t filter_iternext(mp_obj_t self_in) {
const mp_obj_type_t filter_type = {
{ &mp_const_type },
- "filter",
+ .name = MP_QSTR_filter,
.make_new = filter_make_new,
.getiter = mp_identity,
.iternext = filter_iternext,
diff --git a/py/objfloat.c b/py/objfloat.c
index fdb8250568..83b98266e0 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -65,7 +65,7 @@ STATIC mp_obj_t float_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
const mp_obj_type_t float_type = {
{ &mp_const_type },
- "float",
+ .name = MP_QSTR_float,
.print = float_print,
.make_new = float_make_new,
.unary_op = float_unary_op,
diff --git a/py/objfun.c b/py/objfun.c
index 72c23a9ec2..56ea692eaf 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -90,7 +90,7 @@ STATIC mp_obj_t fun_native_call(mp_obj_t self_in, uint n_args, uint n_kw, const
const mp_obj_type_t fun_native_type = {
{ &mp_const_type },
- "function",
+ .name = MP_QSTR_function,
.call = fun_native_call,
};
@@ -160,7 +160,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_o
const mp_obj_type_t fun_bc_type = {
{ &mp_const_type },
- "function",
+ .name = MP_QSTR_function,
.call = fun_bc_call,
};
@@ -277,7 +277,7 @@ STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_
STATIC const mp_obj_type_t fun_asm_type = {
{ &mp_const_type },
- "function",
+ .name = MP_QSTR_function,
.call = fun_asm_call,
};
diff --git a/py/objgenerator.c b/py/objgenerator.c
index dff4ade749..4e7d3a199b 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -39,7 +39,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
const mp_obj_type_t gen_wrap_type = {
{ &mp_const_type },
- "generator",
+ .name = MP_QSTR_generator,
.call = gen_wrap_call,
};
@@ -121,7 +121,7 @@ STATIC const mp_method_t gen_type_methods[] = {
const mp_obj_type_t gen_instance_type = {
{ &mp_const_type },
- "generator",
+ .name = MP_QSTR_generator,
.print = gen_instance_print,
.getiter = gen_instance_getiter,
.iternext = gen_instance_iternext,
diff --git a/py/objgetitemiter.c b/py/objgetitemiter.c
index 0b8b43913f..28b118a526 100644
--- a/py/objgetitemiter.c
+++ b/py/objgetitemiter.c
@@ -38,7 +38,7 @@ STATIC mp_obj_t it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t it_type = {
{ &mp_const_type },
- "iterator",
+ .name = MP_QSTR_iterator,
.iternext = it_iternext
};
diff --git a/py/objint.c b/py/objint.c
index 51d3b7e1f1..1ae3cebbf7 100644
--- a/py/objint.c
+++ b/py/objint.c
@@ -99,7 +99,7 @@ machine_int_t mp_obj_int_get_checked(mp_obj_t self_in) {
const mp_obj_type_t int_type = {
{ &mp_const_type },
- "int",
+ .name = MP_QSTR_int,
.print = int_print,
.make_new = int_make_new,
.unary_op = int_unary_op,
diff --git a/py/objlist.c b/py/objlist.c
index 5516a08f85..844f9cc81f 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -347,7 +347,7 @@ STATIC const mp_method_t list_type_methods[] = {
const mp_obj_type_t list_type = {
{ &mp_const_type },
- "list",
+ .name = MP_QSTR_list,
.print = list_print,
.make_new = list_make_new,
.unary_op = list_unary_op,
@@ -409,7 +409,7 @@ mp_obj_t list_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t list_it_type = {
{ &mp_const_type },
- "list_iterator",
+ .name = MP_QSTR_iterator,
.iternext = list_it_iternext,
};
diff --git a/py/objmap.c b/py/objmap.c
index f7508b2040..012f0aadb5 100644
--- a/py/objmap.c
+++ b/py/objmap.c
@@ -52,7 +52,7 @@ STATIC mp_obj_t map_iternext(mp_obj_t self_in) {
const mp_obj_type_t map_type = {
{ &mp_const_type },
- "map",
+ .name = MP_QSTR_map,
.make_new = map_make_new,
.getiter = map_getiter,
.iternext = map_iternext,
diff --git a/py/objmodule.c b/py/objmodule.c
index 259f1191c9..14a2491711 100644
--- a/py/objmodule.c
+++ b/py/objmodule.c
@@ -39,7 +39,7 @@ STATIC bool module_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
const mp_obj_type_t module_type = {
{ &mp_const_type },
- "module",
+ .name = MP_QSTR_module,
.print = module_print,
.load_attr = module_load_attr,
.store_attr = module_store_attr,
diff --git a/py/objnone.c b/py/objnone.c
index 310478734f..73f2601be4 100644
--- a/py/objnone.c
+++ b/py/objnone.c
@@ -25,7 +25,7 @@ STATIC mp_obj_t none_unary_op(int op, mp_obj_t o_in) {
const mp_obj_type_t none_type = {
{ &mp_const_type },
- "NoneType",
+ .name = MP_QSTR_NoneType,
.print = none_print,
.unary_op = none_unary_op,
};
diff --git a/py/objrange.c b/py/objrange.c
index 38796a68ce..a526ebcec6 100644
--- a/py/objrange.c
+++ b/py/objrange.c
@@ -25,7 +25,7 @@ STATIC mp_obj_t range_getiter(mp_obj_t o_in) {
STATIC const mp_obj_type_t range_type = {
{ &mp_const_type} ,
- "range",
+ .name = MP_QSTR_range,
.getiter = range_getiter,
};
@@ -63,7 +63,7 @@ STATIC mp_obj_t range_it_iternext(mp_obj_t o_in) {
STATIC const mp_obj_type_t range_it_type = {
{ &mp_const_type },
- "range_iterator",
+ .name = MP_QSTR_iterator,
.iternext = range_it_iternext,
};
diff --git a/py/objset.c b/py/objset.c
index 3cb19296f1..580b9de8e6 100644
--- a/py/objset.c
+++ b/py/objset.c
@@ -73,7 +73,7 @@ STATIC mp_obj_t set_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_
const mp_obj_type_t set_it_type = {
{ &mp_const_type },
- "set_iterator",
+ .name = MP_QSTR_iterator,
.iternext = set_it_iternext,
};
@@ -447,7 +447,7 @@ STATIC const mp_method_t set_type_methods[] = {
const mp_obj_type_t set_type = {
{ &mp_const_type },
- "set",
+ .name = MP_QSTR_set,
.print = set_print,
.make_new = set_make_new,
.binary_op = set_binary_op,
diff --git a/py/objslice.c b/py/objslice.c
index b62c4e09ba..66a3c7a7a7 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -23,7 +23,7 @@ void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, m
const mp_obj_type_t ellipsis_type = {
{ &mp_const_type },
- "ellipsis",
+ .name = MP_QSTR_Ellipsis,
.print = ellipsis_print,
};
@@ -50,7 +50,7 @@ void slice_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_o
const mp_obj_type_t slice_type = {
{ &mp_const_type },
- "slice",
+ .name = MP_QSTR_slice,
.print = slice_print,
};
diff --git a/py/objstr.c b/py/objstr.c
index 7089b54d1d..6ccd239959 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -508,7 +508,7 @@ STATIC const mp_method_t str_type_methods[] = {
const mp_obj_type_t str_type = {
{ &mp_const_type },
- "str",
+ .name = MP_QSTR_str,
.print = str_print,
.binary_op = str_binary_op,
.getiter = mp_obj_new_str_iterator,
@@ -518,7 +518,7 @@ const mp_obj_type_t str_type = {
// Reuses most of methods from str
const mp_obj_type_t bytes_type = {
{ &mp_const_type },
- "bytes",
+ .name = MP_QSTR_bytes,
.print = str_print,
.binary_op = str_binary_op,
.getiter = mp_obj_new_bytes_iterator,
@@ -668,7 +668,7 @@ STATIC mp_obj_t str_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t str_it_type = {
{ &mp_const_type },
- "str_iterator",
+ .name = MP_QSTR_iterator,
.iternext = str_it_iternext,
};
@@ -686,7 +686,7 @@ STATIC mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t bytes_it_type = {
{ &mp_const_type },
- "bytes_iterator",
+ .name = MP_QSTR_iterator,
.iternext = bytes_it_iternext,
};
diff --git a/py/objtuple.c b/py/objtuple.c
index f30b9a13c7..de49ce74ef 100644
--- a/py/objtuple.c
+++ b/py/objtuple.c
@@ -175,7 +175,7 @@ STATIC const mp_method_t tuple_type_methods[] = {
const mp_obj_type_t tuple_type = {
{ &mp_const_type },
- "tuple",
+ .name = MP_QSTR_tuple,
.print = tuple_print,
.make_new = tuple_make_new,
.unary_op = tuple_unary_op,
@@ -242,7 +242,7 @@ STATIC mp_obj_t tuple_it_iternext(mp_obj_t self_in) {
STATIC const mp_obj_type_t tuple_it_type = {
{ &mp_const_type },
- "tuple_iterator",
+ .name = MP_QSTR_iterator,
.iternext = tuple_it_iternext,
};
diff --git a/py/objtype.c b/py/objtype.c
index 5b364e6169..a1592140cb 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -257,7 +257,7 @@ bool class_store_item(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
STATIC void type_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
mp_obj_type_t *self = self_in;
- print(env, "<class '%s'>", self->name);
+ print(env, "<class '%s'>", qstr_str(self->name));
}
STATIC mp_obj_t type_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
@@ -271,7 +271,7 @@ STATIC mp_obj_t type_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp
// args[0] = name
// args[1] = bases tuple
// args[2] = locals dict
- return mp_obj_new_type(mp_obj_str_get_str(args[0]), args[1], args[2]);
+ return mp_obj_new_type(mp_obj_str_get_qstr(args[0]), args[1], args[2]);
default:
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "type takes 1 or 3 arguments"));
@@ -284,7 +284,7 @@ STATIC mp_obj_t type_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj
mp_obj_type_t *self = self_in;
if (self->make_new == NULL) {
- nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "cannot create '%s' instances", self->name));
+ nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "cannot create '%s' instances", qstr_str(self->name)));
}
// make new instance
@@ -335,7 +335,7 @@ STATIC bool type_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t value) {
const mp_obj_type_t mp_const_type = {
{ &mp_const_type },
- "type",
+ .name = MP_QSTR_type,
.print = type_print,
.make_new = type_make_new,
.call = type_call,
@@ -343,7 +343,7 @@ const mp_obj_type_t mp_const_type = {
.store_attr = type_store_attr,
};
-mp_obj_t mp_obj_new_type(const char *name, mp_obj_t bases_tuple, mp_obj_t locals_dict) {
+mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) {
assert(MP_OBJ_IS_TYPE(bases_tuple, &tuple_type)); // Micro Python restriction, for now
assert(MP_OBJ_IS_TYPE(locals_dict, &dict_type)); // Micro Python restriction, for now
mp_obj_type_t *o = m_new0(mp_obj_type_t, 1);
@@ -439,7 +439,7 @@ STATIC void super_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
const mp_obj_type_t super_type = {
{ &mp_const_type },
- "super",
+ .name = MP_QSTR_super,
.print = super_print,
.make_new = super_make_new,
.load_attr = super_load_attr,
@@ -521,12 +521,12 @@ STATIC mp_obj_t static_class_method_make_new(mp_obj_t self_in, uint n_args, uint
const mp_obj_type_t mp_type_staticmethod = {
{ &mp_const_type },
- "staticmethod",
+ .name = MP_QSTR_staticmethod,
.make_new = static_class_method_make_new
};
const mp_obj_type_t mp_type_classmethod = {
{ &mp_const_type },
- "classmethod",
+ .name = MP_QSTR_classmethod,
.make_new = static_class_method_make_new
};
diff --git a/py/objzip.c b/py/objzip.c
index 5e5d35df44..8f1bfe143f 100644
--- a/py/objzip.c
+++ b/py/objzip.c
@@ -52,7 +52,7 @@ STATIC mp_obj_t zip_iternext(mp_obj_t self_in) {
const mp_obj_type_t zip_type = {
{ &mp_const_type },
- "zip",
+ .name = MP_QSTR_zip,
.make_new = zip_make_new,
.getiter = zip_getiter,
.iternext = zip_iternext,
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 680c4bcf73..ac106f9830 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -44,6 +44,8 @@ Q(TypeError)
Q(ValueError)
Q(OverflowError)
+Q(NoneType)
+
Q(abs)
Q(all)
Q(any)
@@ -101,6 +103,15 @@ Q(format)
Q(key)
Q(reverse)
+Q(bound_method)
+Q(closure)
+Q(dict_view)
+Q(function)
+Q(generator)
+Q(iterator)
+Q(module)
+Q(slice)
+
Q(<module>)
Q(<lambda>)
Q(<listcomp>)