New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
operations on closed shelves fail cryptically #45933
Comments
shelve objects set self.dict = 0 in their close() method. this "self.dict = 0" in close() is present in current svn trunk too. |
Can you create a patch? I suggest to use self.dict = None as marker for |
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 |
Any reason this is not in trunk yet? |
The usual reasons, probably: nobody had time to work on it, as there are |
I'm working on this one. Alternate patch attached. The problem with the old one is that it slows down every access to the The new patch improves error reporting without changing performance or |
Fixed in r65233 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: