def _prevent_dpkg_apport_error(self, exc_type, exc_obj, exc_tb):
"""Prevent dpkg errors from generating Apport crash reports.
When dpkg reports an error, a SystemError is raised and cleaned
up in C code. However, it seems like the Apport except hook is
called before the C code clears the error, generating crash
reports even though nothing crashed.
This exception hook doesn't call the Apport hook for
SystemErrors, but it calls it for all other errors.
"""
if exc_type is SystemError:
sys.__excepthook__(exc_type, exc_obj, exc_tb)
return
self.old_excepthook(exc_type, exc_obj, exc_tb)
评论列表
文章目录