[issue1592] operations on closed shelves fail cryptically

Erno Kuusela report at bugs.python.org
Wed Dec 12 11:47:47 CET 2007


Erno Kuusela added the comment:

How about the following patch. With it, you get an IOError.

>>> s = shelve.open('/tmp/t', 'c')
>>> s.has_key('foo')
0
>>> s.close()
>>> s.has_key('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "shelve.py", line 107, in has_key
    return self.dict.has_key(key)
  File "shelve.py", line 94, in getdict
    raise IOError, 'shelf has been closed'
IOError: shelf has been closed

Added file: http://bugs.python.org/file8930/shelve.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1592>
__________________________________
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: shelve.diff
Url: http://mail.python.org/pipermail/python-bugs-list/attachments/20071212/8a966650/attachment.txt 


More information about the Python-bugs-list mailing list