1.1 --- a/lib/builtins.py Wed Jun 16 01:08:18 2010 +0200
1.2 +++ b/lib/builtins.py Thu Jun 17 00:35:37 2010 +0200
1.3 @@ -26,7 +26,11 @@
1.4
1.5 class basestring(object):
1.6 def __init__(self, x=None): pass
1.7 - def __getitem__(self, index): pass
1.8 +
1.9 + def __getitem__(self, index):
1.10 + # Note usage.
1.11 + IndexError
1.12 +
1.13 def __getslice__(self, start, end=None): pass
1.14 def __iadd__(self, other): pass
1.15 def __add__(self, other): pass
1.16 @@ -61,7 +65,10 @@
1.17 class dict(object):
1.18 def __init__(self, *args): pass
1.19 def __setitem__(self, key, value): pass
1.20 - def __getitem__(self, key): pass
1.21 +
1.22 + def __getitem__(self, key):
1.23 + # Note usage.
1.24 + KeyError
1.25
1.26 class file(object):
1.27 def write(self, s): pass
1.28 @@ -160,7 +167,10 @@
1.29 # Reserve space for a fragment reference.
1.30 self._elements = None
1.31
1.32 - def __getitem__(self, index): pass
1.33 + def __getitem__(self, index):
1.34 + # Note usage.
1.35 + IndexError
1.36 +
1.37 def __setitem__(self, index, value): pass
1.38 def __getslice__(self, start, end=None): pass
1.39 def __setslice__(self, start, end, slice): pass
1.40 @@ -243,7 +253,11 @@
1.41
1.42 class tuple(object):
1.43 def __init__(self, args): pass
1.44 - def __getitem__(self, index): pass
1.45 +
1.46 + def __getitem__(self, index):
1.47 + # Note usage.
1.48 + IndexError
1.49 +
1.50 def __getslice__(self, start, end=None): pass
1.51 def __len__(self): pass
1.52 def __add__(self, other): pass
1.53 @@ -474,9 +488,9 @@
1.54 AttributeError
1.55 #StopIteration
1.56 TypeError
1.57 -IndexError
1.58 +#IndexError
1.59
1.60 -list
1.61 +#list
1.62 tuple
1.63 #xrange
1.64 #ellipsis
2.1 --- a/micropython/inspect.py Wed Jun 16 01:08:18 2010 +0200
2.2 +++ b/micropython/inspect.py Thu Jun 17 00:35:37 2010 +0200
2.3 @@ -863,7 +863,9 @@
2.4
2.5 visitLeftShift = _visitBinary
2.6
2.7 - visitList = OP
2.8 + def visitList(self, node):
2.9 + self.use_attribute("__builtins__", "list")
2.10 + self.OP(node)
2.11
2.12 def visitListComp(self, node):
2.13 for qual in node.quals:
2.14 @@ -932,7 +934,7 @@
2.15 visitRightShift = _visitBinary
2.16
2.17 def visitSlice(self, node):
2.18 - self.use_name("slice", node)
2.19 + self.use_attribute("__builtins__", "slice")
2.20 self.use_name("__getitem__", node)
2.21 self.OP(node)
2.22
3.1 --- a/rsvp.py Wed Jun 16 01:08:18 2010 +0200
3.2 +++ b/rsvp.py Thu Jun 17 00:35:37 2010 +0200
3.3 @@ -141,7 +141,11 @@
3.4 self.breakpoints = set()
3.5
3.6 def _get_class(self, module, name):
3.7 - return self._objlist.access(module, name).get_value()
3.8 + attr = self._objlist.access(module, name)
3.9 + if attr is not None:
3.10 + return attr.get_value()
3.11 + else:
3.12 + return None
3.13
3.14 # Debugging methods.
3.15
4.1 --- a/rsvplib.py Wed Jun 16 01:08:18 2010 +0200
4.2 +++ b/rsvplib.py Thu Jun 17 00:35:37 2010 +0200
4.3 @@ -43,14 +43,17 @@
4.4 self.int_class = cls.location
4.5 self.int_instance = cls.instance_template_location
4.6 cls = self.machine._get_class("__builtins__", "list")
4.7 - self.list_class = cls.location
4.8 - self.list_instance = cls.instance_template_location
4.9 + if cls is not None:
4.10 + self.list_class = cls.location
4.11 + self.list_instance = cls.instance_template_location
4.12 cls = self.machine._get_class("__builtins__", "IndexError")
4.13 - self.index_error = cls.location
4.14 - self.index_error_instance = cls.instance_template_location
4.15 + if cls is not None:
4.16 + self.index_error = cls.location
4.17 + self.index_error_instance = cls.instance_template_location
4.18 cls = self.machine._get_class("__builtins__", "basestring")
4.19 - self.str_class = cls.location
4.20 - self.str_instance = cls.instance_template_location
4.21 + if cls is not None:
4.22 + self.str_class = cls.location
4.23 + self.str_instance = cls.instance_template_location
4.24
4.25 self.tuple_class = self.machine.tuple_class
4.26 self.type_error_instance = self.machine.type_error_instance