This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Can't save empty array in shelve
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: iwl, rhettinger
Priority: normal Keywords:

Created on 2007-04-02 16:19 by iwl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31690 - (view) Author: IWL (iwl) Date: 2007-04-02 16:19
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. 
msg31691 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-04-02 17:29
Fixed.  See versions 54657 and 54658.
History
Date User Action Args
2022-04-11 14:56:23adminsetgithub: 44796
2007-04-02 16:19:37iwlcreate