This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Steve Howell
Recipients Steve Howell
Date 2010-01-26.08:12:02
SpamBayes Score 2.219424e-05
Marked as misclassified No
Message-id <1264493526.37.0.587552008343.issue7782@psf.upfronthosting.co.za>
In-reply-to
Content
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):
            lst.pop(0)
        lst.extend(gen())

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.
History
Date User Action Args
2010-01-26 08:12:06Steve Howellsetrecipients: + Steve Howell
2010-01-26 08:12:06Steve Howellsetmessageid: <1264493526.37.0.587552008343.issue7782@psf.upfronthosting.co.za>
2010-01-26 08:12:04Steve Howelllinkissue7782 messages
2010-01-26 08:12:02Steve Howellcreate