BUG?: Saving empty array in shelve

I

iwl

Hi,

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.
 
P

Peter Otten

iwl said:
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 "<stdin>", line 1, in <module>
TypeError: ("'NoneType' object is not iterable", <type 'array.array'>, ('f',
None))

Please submit a bug report.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,208
Latest member
RandallLay

Latest Threads

Top