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.

Author dairiki
Recipients
Date 2005-10-26.23:30:42
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Python calls an object's __del__ method, even if the
objects __init__ method was unsuccessful (i.e. __init__
terminated via exception.)

Because of this, if there is an error while attempting
to open a Shelf, the destructor is still called, even
though the Shelf is not fully constructed.  The code in
shelve.Shelf does not check for this possibility, and
therefor triggers an AttributeError.

Here is an example script which should reproduce the error.

===Begin test.py====l
import shelve
try:
    shelf = shelve.open('non-existant-file', flag='r')
except:
    pass
===End test.py=====

For me, the above script produces the message:

Exception exceptions.AttributeError: "DbfilenameShelf
instance has no attribute 'writeback'" in  ignored

I can reproduce this using either Python 2.4.1 or
2.3.5.  I took a quick look at the current CVS version
of shelve.py, and it appears to suffer the same problem.





History
Date User Action Args
2007-08-23 14:35:50adminlinkissue1339007 messages
2007-08-23 14:35:50admincreate