]> granicus.if.org Git - python/commit
Issue 7835: Shelve's __del__ method calls its close method, and its
authorR. David Murray <rdmurray@bitdance.com>
Wed, 10 Feb 2010 22:42:04 +0000 (22:42 +0000)
committerR. David Murray <rdmurray@bitdance.com>
Wed, 10 Feb 2010 22:42:04 +0000 (22:42 +0000)
commit63e4fd7eef8d2da09634e9416dd29fc28d8b8620
tree68d971fb24ac4ba9a23a0ee5b8735cf5530a0d8e
parent8f6a28702961430a2217be64d9d53e2ea490f1b3
Issue 7835:  Shelve's __del__ method calls its close method, and its
close method refers to an identifier in the global module namespace.
This means that when __del__ is called during interpreter shutdown (if,
for example, the calling program still has a pointer to the shelf),
sometimes that global identifier would wind up being None, causing
mysterious 'ignored' exceptions.  This patch checks for the possible None
value first before using the global, thus avoiding the error messages.
Lib/shelve.py
Misc/NEWS