diff options
| author | Jeff Epler | 2018-03-25 16:05:32 -0500 |
|---|---|---|
| committer | Damien George | 2018-05-30 11:11:24 +1000 |
| commit | 05b13fd292b42f20affc7cae218d92447efbf6d6 (patch) | |
| tree | 2b1f043c3000288fc01eb045eed7b0942e39f6b7 /tests | |
| parent | a1acbad27a1e996c8f95b3d1c801aa2e31df9c99 (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.py | 18 |
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') |
