diff options
author | Damien George <damien.p.george@gmail.com> | 2015-05-03 23:23:18 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-05-04 11:08:40 +0100 |
commit | 47b9809d231c4359c56316130a76f13de2b907f7 (patch) | |
tree | ca8b6341b8e28f6c2692e92005bb8f072b14b5a3 /tests | |
parent | 0116218fa89cc88d5d5ed7291c4f8d3412f78543 (diff) | |
download | micropython-47b9809d231c4359c56316130a76f13de2b907f7.tar.gz micropython-47b9809d231c4359c56316130a76f13de2b907f7.zip |
py: Check that arg to object.__new__ is a user-defined type.
Addresses issue #1203.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/object_new.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/object_new.py b/tests/basics/object_new.py index 6131ed337e..befb5bfc27 100644 --- a/tests/basics/object_new.py +++ b/tests/basics/object_new.py @@ -18,3 +18,13 @@ o.__init__() #print(dir(o)) print(hasattr(o, "attr")) print(o.attr) + +# should only be able to call __new__ on user types +try: + object.__new__(1) +except TypeError: + print("TypeError") +try: + object.__new__(int) +except TypeError: + print("TypeError") |