BUG?: Saving empty array in shelve

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • iwl

    #1

    BUG?: Saving empty array in shelve

    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.

  • Peter Otten

    #2
    Re: BUG?: Saving empty array in shelve

    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(a rray("f", [1])))
    array('f', [1.0])
    >>loads(dumps(a rray("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

    Comment

    Working...