From 6da8d7c46583387aa32d5c153b3c5b7d9e1afccd Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 25 Mar 2018 16:05:32 -0500 Subject: Fix assertion failures in mp_obj_new_type Fixes the following assertion failures when the arguments to type() were not of valid types: micropython: ../../py/objtype.c:984: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(bases_tuple, &mp_type_tuple)' failed. micropython: ../../py/objtype.c:994: mp_obj_new_type: Assertion `MP_OBJ_IS_TYPE(items[i], &mp_type_type)' failed. e.g., when making calls like type("", (), 3) type("", 3, {}) --- tests/basics/types3.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/basics/types3.py (limited to 'tests') diff --git a/tests/basics/types3.py b/tests/basics/types3.py new file mode 100644 index 000000000..71f790692 --- /dev/null +++ b/tests/basics/types3.py @@ -0,0 +1,20 @@ +try: + type('abc', None, None) +except TypeError: + print(True) +else: + print(False) + +try: + type('abc', (), None) +except TypeError: + print(True) +else: + print(False) + +try: + type('abc', (1,), {}) +except TypeError: + print(True) +else: + print(False) -- cgit v1.2.3