summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/unix/main.c13
-rw-r--r--py/obj.h1
-rw-r--r--py/objtype.c3
3 files changed, 2 insertions, 15 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 530e20a38..5f6b99f98 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -616,19 +616,6 @@ MP_NOINLINE int main_(int argc, char **argv) {
}
#endif
- // Here is some example code to create a class and instance of that class.
- // First is the Python, then the C code.
- //
- // class TestClass:
- // pass
- // test_obj = TestClass()
- // test_obj.attr = 42
- //
- // mp_obj_t test_class_type, test_class_instance;
- // test_class_type = mp_obj_new_type(qstr_from_str("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
- // mp_store_name(qstr_from_str("test_obj"), test_class_instance = mp_call_function_0(test_class_type));
- // mp_store_attr(test_class_instance, qstr_from_str("attr"), mp_obj_new_int(42));
-
/*
printf("bytes:\n");
printf(" total %d\n", m_get_total_bytes_allocated());
diff --git a/py/obj.h b/py/obj.h
index 4ac0cc0c6..69d6e626d 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -987,7 +987,6 @@ void *mp_obj_malloc_with_finaliser_helper(size_t num_bytes, const mp_obj_type_t
bool mp_obj_is_dict_or_ordereddict(mp_obj_t o);
#define mp_obj_is_fun(o) (mp_obj_is_obj(o) && (((mp_obj_base_t *)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_function))
-mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
static inline mp_obj_t mp_obj_new_bool(mp_int_t x) {
return x ? mp_const_true : mp_const_false;
}
diff --git a/py/objtype.c b/py/objtype.c
index 818ceeb05..25c2dee99 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -44,6 +44,7 @@
#define ENABLE_SPECIAL_ACCESSORS \
(MICROPY_PY_DESCRIPTORS || MICROPY_PY_DELATTR_SETATTR || MICROPY_PY_BUILTINS_PROPERTY)
+static mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict);
static mp_obj_t mp_obj_is_subclass(mp_obj_t object, mp_obj_t classinfo);
static mp_obj_t static_class_method_make_new(const mp_obj_type_t *self_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
@@ -1164,7 +1165,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
attr, type_attr
);
-mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) {
+static mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) {
// Verify input objects have expected type
if (!mp_obj_is_type(bases_tuple, &mp_type_tuple)) {
mp_raise_TypeError(NULL);