diff options
author | Damien George <damien.p.george@gmail.com> | 2018-02-07 15:44:29 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-02-07 15:44:29 +1100 |
commit | b45c8c17f0f295e919a90659d4c1880a47b228c1 (patch) | |
tree | 97baec306a8914ce429d3802862239b2bf4b485c /tests/basics/setattr1.py | |
parent | cc92c0572e2b6dba3c5897d5778704aaccbb567e (diff) |
py/objtype: Check and prevent delete/store on a fixed locals map.
Note that the check for elem!=NULL is removed for the
MP_MAP_LOOKUP_ADD_IF_NOT_FOUND case because mp_map_lookup will always
return non-NULL for such a case.
Diffstat (limited to 'tests/basics/setattr1.py')
-rw-r--r-- | tests/basics/setattr1.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basics/setattr1.py b/tests/basics/setattr1.py index 9693aca81..e4acb14ca 100644 --- a/tests/basics/setattr1.py +++ b/tests/basics/setattr1.py @@ -16,3 +16,10 @@ try: setattr(a, b'var3', 1) except TypeError: print('TypeError') + +# try setattr on a built-in function +try: + setattr(int, 'to_bytes', 1) +except (AttributeError, TypeError): + # uPy raises AttributeError, CPython raises TypeError + print('AttributeError/TypeError') |