|
|
@@ -6,6 +6,7 @@ import sys |
|
|
|
import json |
|
|
|
import decorator |
|
|
|
import functools |
|
|
|
import threading |
|
|
|
|
|
|
|
import cherrypy |
|
|
|
|
|
|
@@ -178,6 +179,19 @@ def cherrypy_patch_exit(): |
|
|
|
os._exit = real_exit |
|
|
|
bus.exit = functools.partial(patched_exit, bus.exit) |
|
|
|
|
|
|
|
# A behavior change in Python 3.8 means that some thread exceptions, |
|
|
|
# derived from SystemExit, now print tracebacks where they didn't |
|
|
|
# used to: https://bugs.python.org/issue1230540 |
|
|
|
# Install a thread exception hook that ignores CherryPyExit; |
|
|
|
# to make this match the behavior where we didn't set |
|
|
|
# threading.excepthook, we also need to ignore SystemExit. |
|
|
|
def hook(args): |
|
|
|
if args.exc_type == CherryPyExit or args.exc_type == SystemExit: |
|
|
|
return |
|
|
|
sys.excepthook(args.exc_type, args.exc_value, |
|
|
|
args.exc_traceback) # pragma: no cover |
|
|
|
threading.excepthook = hook |
|
|
|
|
|
|
|
|
|
|
|
# Start/stop CherryPy standalone server |
|
|
|
def cherrypy_start(blocking=False, event=False): |
|
|
|