Commit b3048e1a authored by Stefan Behnel's avatar Stefan Behnel

check for None during optimised indexing into list/tuple, unify exception message

parent 5aac8caf
...@@ -2685,8 +2685,9 @@ class IndexNode(ExprNode): ...@@ -2685,8 +2685,9 @@ class IndexNode(ExprNode):
elif is_slice and base_type in (bytes_type, str_type, unicode_type, list_type, tuple_type): elif is_slice and base_type in (bytes_type, str_type, unicode_type, list_type, tuple_type):
self.type = base_type self.type = base_type
else: else:
if base_type is dict_type: if base_type in (list_type, tuple_type, dict_type):
self.base = self.base.as_none_safe_node("'NoneType' object is unsubscriptable") # do the None check explicitly (not in a helper) to allow optimising it away
self.base = self.base.as_none_safe_node("'NoneType' object is not subscriptable")
self.type = py_object_type self.type = py_object_type
else: else:
if base_type.is_ptr or base_type.is_array: if base_type.is_ptr or base_type.is_array:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment