New submission from showell <showel...@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):
            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.

----------
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue7782>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to