Ignore exceptions during __del__ handlers, which may get called during shutdown
This commit is contained in:
parent
8bb8f068de
commit
0a22db3965
nilmdb/utils
|
@ -28,10 +28,13 @@ def must_close(errorfile = sys.stderr, wrap_verify = False):
|
|||
|
||||
@wrap_class_method
|
||||
def __del__(orig, self, *args, **kwargs):
|
||||
if "_must_close" in self.__dict__:
|
||||
fprintf(errorfile, "error: %s.close() wasn't called!\n",
|
||||
self.__class__.__name__)
|
||||
return orig(self, *args, **kwargs)
|
||||
try:
|
||||
if "_must_close" in self.__dict__:
|
||||
fprintf(errorfile, "error: %s.close() wasn't called!\n",
|
||||
self.__class__.__name__)
|
||||
return orig(self, *args, **kwargs)
|
||||
except: # pragma: no cover
|
||||
pass
|
||||
|
||||
@wrap_class_method
|
||||
def close(orig, self, *args, **kwargs):
|
||||
|
|
|
@ -120,7 +120,7 @@ def serializer_proxy(obj_or_type):
|
|||
try:
|
||||
self.__call_queue.put((None, None, None, None))
|
||||
self.__thread.join()
|
||||
except TypeError: # pragma: no cover
|
||||
except: # pragma: no cover
|
||||
pass
|
||||
|
||||
return SerializerObjectProxy(obj_or_type)
|
||||
|
|
Loading…
Reference in New Issue
Block a user