scrapy/scrapy — pull request #46 by mattd (2011-10-12 20:20:32+00:00)
Title: Fix big in PickleItemExporter that created invalid pickle dumps.

My attempts to use the PickleItemExporter were resulting in invalid pickle files. It took me awhile to figure out that the cause of the problem was the the Item keys were being exhausted after the first run of export_item. The result was that the first pickled item included both keys and values where subsequent Items had only values. This broke the pickle and made it unloadable.

Unfortunately, I'm not *totally* sure where the bug was coming from. The call to item.iterkeys() in _get_serialized_fields seems to be what's blowing up, so it's almost certainly a problem with the use of generators. The code that was here is what I would have written, so I'm a bit baffled.

This commit, however, does fix the problem.