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.
This commit is contained in:
Damien George
2018-02-07 15:44:29 +11:00
parent cc92c0572e
commit b45c8c17f0
3 changed files with 20 additions and 6 deletions

View File

@@ -30,3 +30,10 @@ try:
del c.x
except AttributeError:
print("AttributeError")
# try to del an attribute of a built-in class
try:
del int.to_bytes
except (AttributeError, TypeError):
# uPy raises AttributeError, CPython raises TypeError
print('AttributeError/TypeError')