Commit bea53ada authored by Guido van Rossum's avatar Guido van Rossum

Another fix. Partly reverted the tweaks done by the previous fix.

parent 911b9218
...@@ -290,8 +290,8 @@ class BuiltinTest(unittest.TestCase): ...@@ -290,8 +290,8 @@ class BuiltinTest(unittest.TestCase):
if key == 'a': if key == 'a':
return 12 return 12
raise KeyError raise KeyError
def __iter__(self): def keys(self):
return iter('xyz') return list('xyz')
m = M() m = M()
g = globals() g = globals()
...@@ -313,8 +313,8 @@ class BuiltinTest(unittest.TestCase): ...@@ -313,8 +313,8 @@ class BuiltinTest(unittest.TestCase):
if key == 'a': if key == 'a':
return 12 return 12
return dict.__getitem__(self, key) return dict.__getitem__(self, key)
def __iter__(self): def keys(self):
return iter('xyz') return list('xyz')
d = D() d = D()
self.assertEqual(eval('a', g, d), 12) self.assertEqual(eval('a', g, d), 12)
...@@ -346,8 +346,8 @@ class BuiltinTest(unittest.TestCase): ...@@ -346,8 +346,8 @@ class BuiltinTest(unittest.TestCase):
class C: class C:
def __getitem__(self, item): def __getitem__(self, item):
raise KeyError(item) raise KeyError(item)
def __iter__(self): def keys(self):
return 'a' # XXX Not quite faithful to the SF bug... return 1 # used to be 'a' but that's no longer an error
self.assertRaises(TypeError, eval, 'dir()', globals(), C()) self.assertRaises(TypeError, eval, 'dir()', globals(), C())
# Done outside of the method test_z to get the correct scope # Done outside of the method test_z to get the correct scope
......
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