Issue1592
Created on 2007-12-11 18:38 by erno, last changed 2008-07-25 18:44 by rhettinger.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
shelve.diff
|
erno,
2007-12-12 10:47
|
|
|
|
|
shelve.diff
|
rhettinger,
2008-07-25 18:00
|
Alternate patch |
|
|
|
msg58453 - (view) |
Author: Erno Kuusela (erno) |
Date: 2007-12-11 18:38 |
|
shelve objects set self.dict = 0 in their close() method. this
results in errors such as TypeError: unsubscriptable object and
AttributeError: 'int' object has no attribute 'has_key'.
This is fairly baffling for the user.
"self.dict = 0" in close() is present in current svn trunk too.
|
|
msg58463 - (view) |
Author: Christian Heimes (christian.heimes) |
Date: 2007-12-11 20:17 |
|
Can you create a patch? I suggest to use self.dict = None as marker for
a closed shelf.
|
|
msg58490 - (view) |
Author: Erno Kuusela (erno) |
Date: 2007-12-12 10:47 |
|
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
|
|
msg70257 - (view) |
Author: Miki Tebeka (tebeka) |
Date: 2008-07-25 15:36 |
|
Any reason this is not in trunk yet?
|
|
msg70261 - (view) |
Author: Martin v. Löwis (loewis) |
Date: 2008-07-25 17:44 |
|
The usual reasons, probably: nobody had time to work on it, as there are
so many other things to do.
|
|
msg70265 - (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-07-25 18:00 |
|
I'm working on this one. Alternate patch attached.
The problem with the old one is that it slows down every access to the
shelf and it prevents assignment to self.dict which has always been
allowed.
The new patch improves error reporting without changing performance or
semantics for shelves prior to closing.
|
|
msg70268 - (view) |
Author: Raymond Hettinger (rhettinger) |
Date: 2008-07-25 18:44 |
|
Fixed in r65233
|
|
| Date |
User |
Action |
Args |
| 2008-07-25 18:44:01 | rhettinger | set | status: open -> closed resolution: fixed messages:
+ msg70268 |
| 2008-07-25 18:00:43 | rhettinger | set | files:
+ shelve.diff keywords:
+ patch messages:
+ msg70265 |
| 2008-07-25 17:44:11 | loewis | set | nosy:
+ loewis messages:
+ msg70261 |
| 2008-07-25 16:09:17 | rhettinger | set | assignee: rhettinger nosy:
+ rhettinger versions:
- Python 2.5 |
| 2008-07-25 15:36:28 | tebeka | set | nosy:
+ tebeka messages:
+ msg70257 |
| 2007-12-12 10:47:47 | erno | set | files:
+ shelve.diff messages:
+ msg58490 |
| 2007-12-11 20:17:45 | christian.heimes | set | priority: low nosy:
+ christian.heimes messages:
+ msg58463 versions:
+ Python 2.6, Python 2.5, Python 3.0, - Python 2.4 |
| 2007-12-11 18:38:16 | erno | create | |
|