Avoid exceptions during auto-close of registry keys

This commit is contained in:
Kovid Goyal 2015-03-05 12:38:53 +05:30
parent ff82ba858c
commit 7b8eff6efd

View File

@ -263,7 +263,7 @@ class Key(object):
return bool(self.hkey)
def close(self):
if not self.hkey:
if not getattr(self, 'hkey', None):
return
if RegCloseKey is None or HKEY is None:
return # globals become None during exit