Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd70eee

Browse files
committed
Another fix. Partly reverted the tweaks done by the previous fix.
1 parent 091153d commit cd70eee

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/test/test_builtin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ def __getitem__(self, key):
290290
if key == 'a':
291291
return 12
292292
raise KeyError
293-
def __iter__(self):
294-
return iter('xyz')
293+
def keys(self):
294+
return list('xyz')
295295

296296
m = M()
297297
g = globals()
@@ -313,8 +313,8 @@ def __getitem__(self, key):
313313
if key == 'a':
314314
return 12
315315
return dict.__getitem__(self, key)
316-
def __iter__(self):
317-
return iter('xyz')
316+
def keys(self):
317+
return list('xyz')
318318

319319
d = D()
320320
self.assertEqual(eval('a', g, d), 12)
@@ -346,8 +346,8 @@ def __getitem__(self, key):
346346
class C:
347347
def __getitem__(self, item):
348348
raise KeyError(item)
349-
def __iter__(self):
350-
return 'a' # XXX Not quite faithful to the SF bug...
349+
def keys(self):
350+
return 1 # used to be 'a' but that's no longer an error
351351
self.assertRaises(TypeError, eval, 'dir()', globals(), C())
352352

353353
# Done outside of the method test_z to get the correct scope

0 commit comments

Comments
 (0)