[ python-Bugs-1693079 ] Can't save empty array in shelve

SourceForge.net noreply at sourceforge.net
Mon Apr 2 19:29:48 CEST 2007


Bugs item #1693079, was opened at 2007-04-02 11:19
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1693079&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: IWL (iwl)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Can't save empty array in shelve

Initial Comment:

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

Please submit a bug report. 


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2007-04-02 12:29

Message:
Logged In: YES 
user_id=80475
Originator: NO

Fixed.  See versions 54657 and 54658.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1693079&group_id=5470


More information about the Python-bugs-list mailing list