1.1 --- a/lib/builtins.py Sat Jun 12 02:47:03 2010 +0200
1.2 +++ b/lib/builtins.py Sat Jun 12 03:04:08 2010 +0200
1.3 @@ -197,7 +197,7 @@
1.4 self.i += 1
1.5 return value
1.6 except IndexError:
1.7 - raise StopIteration
1.8 + raise StopIteration()
1.9
1.10 class long(object):
1.11 def __init__(self, number_or_string=None): pass
1.12 @@ -249,9 +249,14 @@
1.13 def __len__(self): pass
1.14 def __add__(self, other): pass
1.15 def __str__(self): pass
1.16 - def __iter__(self): pass
1.17 def __bool__(self): pass
1.18
1.19 + def __iter__(self):
1.20 +
1.21 + "Return an iterator."
1.22 +
1.23 + return listiterator(self)
1.24 +
1.25 class unicode(basestring):
1.26 pass
1.27
2.1 --- a/micropython/__init__.py Sat Jun 12 02:47:03 2010 +0200
2.2 +++ b/micropython/__init__.py Sat Jun 12 03:04:08 2010 +0200
2.3 @@ -334,7 +334,7 @@
2.4 }
2.5
2.6 names_always_used = [
2.7 - "bool", "__init__", "__call__", "__bool__"
2.8 + "bool", "__call__", "__bool__"
2.9 ]
2.10
2.11 def __init__(self, path=None, verbose=0, optimisations=None):
2.12 @@ -542,6 +542,7 @@
2.13 # in this initialiser.
2.14
2.15 if "__init__" in objtable.table.get(from_name, []):
2.16 + self.use_attribute(from_name, "__init__")
2.17 self._collect_attributes(from_name + ".__init__", objtable)
2.18
2.19 # Constant accounting.
3.1 --- a/micropython/trans.py Sat Jun 12 02:47:03 2010 +0200
3.2 +++ b/micropython/trans.py Sat Jun 12 03:04:08 2010 +0200
3.3 @@ -1206,8 +1206,11 @@
3.4 else:
3.5 raise TranslateError(self.module.full_name(), node, "Module %r has no attribute %r." % (self.module, name))
3.6
3.7 + elif scope == "builtins":
3.8 + self.new_op(AddressInstruction(self.get_builtin(name, node)))
3.9 +
3.10 else:
3.11 - self.new_op(AddressInstruction(self.get_builtin(name, node)))
3.12 + raise TranslateError(self.module.full_name(), node, "Program unit %r uses unknown name %r." % (self.unit, name))
3.13
3.14 def _visitUnary(self, node):
3.15
4.1 --- a/tests/op_add_default.py Sat Jun 12 02:47:03 2010 +0200
4.2 +++ b/tests/op_add_default.py Sat Jun 12 03:04:08 2010 +0200
4.3 @@ -1,10 +1,11 @@
4.4 #!/usr/bin/env python
4.5
4.6 +a = 10 # used in f default
4.7 +b = 20 # used in f default
4.8 +
4.9 def f(a, b, c=a+b):
4.10 return a + b + c
4.11
4.12 -a = 10 # used in f default
4.13 -b = 20 # used in f default
4.14 result_33 = f(1, 2)
4.15
4.16 # vim: tabstop=4 expandtab shiftwidth=4