[New-bugs-announce] [issue7782] new test for test_iter.py

showell report at bugs.python.org
Tue Jan 26 09:12:06 CET 2010

New submission from showell <showell30 at yahoo.com>:

I would like to submit the following test to be part of the test_iter.py test suite:

    def test_extends(self):
        # This test would break on an incomplete patch to listobject.c
        def gen():
            for i in range(500):
                yield i
        lst = [0] * 500
        for i in range(240):

The history behind it is that I made a patch to listobject.c that obviously broke listextend(), but the tests did not catch it.  This was my failing test to improve my patch.  Regardless of what happens to the patch, I think it's a good idea to hammer on listextend() when it accepts an iterator, as it's a fairly tricky problem to extend a list when you do not know in advance how long it will be until the iterator gets exhausted.

components: Tests
messages: 98320
nosy: Steve Howell
severity: normal
status: open
title: new test for test_iter.py
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list