aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeff Epler2018-03-25 16:05:32 -0500
committerDamien George2018-05-30 11:11:24 +1000
commit05b13fd292b42f20affc7cae218d92447efbf6d6 (patch)
tree2b1f043c3000288fc01eb045eed7b0942e39f6b7 /tests
parenta1acbad27a1e996c8f95b3d1c801aa2e31df9c99 (diff)
py/objtype: Fix assertion failures in mp_obj_new_type by checking types.
Fixes assertion failures when the arguments to type() were not of valid types, e.g., when making calls like: type("", (), 3) type("", 3, {})
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/builtin_type.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/builtin_type.py b/tests/basics/builtin_type.py
index 83c45c64b..c5fb36626 100644
--- a/tests/basics/builtin_type.py
+++ b/tests/basics/builtin_type.py
@@ -11,3 +11,21 @@ try:
type(1, 2)
except TypeError:
print('TypeError')
+
+# second arg should be a tuple
+try:
+ type('abc', None, None)
+except TypeError:
+ print('TypeError')
+
+# third arg should be a dict
+try:
+ type('abc', (), None)
+except TypeError:
+ print('TypeError')
+
+# elements of second arg (the bases) should be types
+try:
+ type('abc', (1,), {})
+except TypeError:
+ print('TypeError')