Issue 1693079: Can't save empty array in shelve (original) (raw)

iwl wrote:

I've tryed to save some data containing empty arrays (array('f')) in a shelve. It looks like the shelve has some problems with empty arrays, get allways: TypeError: ("'NoneType' object is not iterable", <type 'array.array'>, ('f', None))- Messages when dealing with the readed back shelve. Seems like I have to avoid empty arrays in a shelve.

That seems to be a bug in the underlying pickling mechanism:

from array import array from cPickle import loads, dumps loads(dumps(array("f", [1]))) array('f', [1.0]) loads(dumps(array("f")))

Traceback (most recent call last): File "", line 1, in TypeError: ("'NoneType' object is not iterable", <type 'array.array'>, ('f', None))

Please submit a bug report.