[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#572596: python-apt: TagSection corruption when iterating through a TagFile



On Thu, Mar 04, 2010 at 07:01:33PM -0700, John Wright wrote:
> # This prints nothing
> print "Testing while iterating"
> test_keys(deb822_objs, apt_pkg.TagFile(open("/tmp/test_Packages")))
> 
> # This has errors, apt_pkg data is corrupt
> print "Testing after making a list from the iterator"
> test_keys(deb822_objs, list(apt_pkg.TagFile(open("/tmp/test_Packages"))))
> 
> # This doesn't have an error for me
> print "Testing after making a list out of only the first 30 entries"
> shorter = []
> sections = iter(apt_pkg.TagFile(open("/tmp/test_Packages")))
> for i in range(30):
>     shorter.append(sections.next())
> test_keys(deb822_objs, shorter)
> 
> # This doesn't have an error for me

Oops, I mean this *does* have an error for me (as you could see from the
command's output.

> print "Testing after making a list out of only the first 35 entries"
> shorter = []
> sections = iter(apt_pkg.TagFile(open("/tmp/test_Packages")))
> for i in range(35):
>     shorter.append(sections.next())
> test_keys(deb822_objs, shorter)

-- 
John Wright <jsw@debian.org>



Reply to: