def raise_in_main_thread(exception_type=Exception):
try:
yield
except ProcessExiting:
# this exception is meant to stay within the thread
raise
except exception_type as exc:
if threading.current_thread() is threading.main_thread():
raise
exc._raised_asynchronously = True
global LAST_ERROR
if LAST_ERROR:
_logger.warning("a different error (%s) is pending - skipping", type(LAST_ERROR))
raise
LAST_ERROR = exc
_rimt(exc)
评论列表
文章目录