Fix Issue 1045.

Factor-out common calling code by simplifying the length_hint API.
Speed-up the function by caching the PyObject_String for the attribute lookup.
This commit is contained in:
Raymond Hettinger 2007-12-06 00:56:53 +00:00
parent 923ad7a948
commit 4e2f714031
5 changed files with 48 additions and 86 deletions

View file

@ -523,7 +523,5 @@ class CommonTest(seq_tests.CommonTest):
# Bug #1242657
class F(object):
def __iter__(self):
yield 23
def __len__(self):
raise KeyboardInterrupt
self.assertRaises(KeyboardInterrupt, list, F())