diff options
author | Damien George <damien.p.george@gmail.com> | 2015-11-23 15:57:00 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-23 15:57:00 +0000 |
commit | 0e3f29cc9973dc3c522941858f1f0fb4c6b2cba0 (patch) | |
tree | 3fe6fc35c3a453ae6a525a18170cd5bce90220f6 /tests | |
parent | a8aa1998ce1d602738dfab15a5d8b9335586aad6 (diff) | |
download | micropython-0e3f29cc9973dc3c522941858f1f0fb4c6b2cba0.tar.gz micropython-0e3f29cc9973dc3c522941858f1f0fb4c6b2cba0.zip |
py: Check that second argument to hasattr is actually a string.
Fixes issue #1623.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/hasattr1.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/hasattr1.py b/tests/basics/hasattr1.py index b1c4b5ceb6..118a19e579 100644 --- a/tests/basics/hasattr1.py +++ b/tests/basics/hasattr1.py @@ -27,3 +27,13 @@ c = C() print(hasattr(c, "exists")) # TODO #print(hasattr(c, "doesnt_exist")) + +try: + hasattr(1, b'123') +except TypeError: + print('TypeError') + +try: + hasattr(1, 123) +except TypeError: + print('TypeError') |