Fix signal handler types.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-25 13:09:07 -07:00
parent 98e23bdfd4
commit 2ecabb3260
3 changed files with 6 additions and 5 deletions

View file

@ -6,11 +6,12 @@ import subprocess
import sys
import traceback
from types import FrameType
from typing import Optional
from zulip import RandomExponentialBackoff
def die(signal: int, frame: FrameType) -> None:
def die(signal: int, frame: Optional[FrameType]) -> None:
"""We actually want to exit, so run os._exit (so as not to be caught and restarted)"""
os._exit(1)

View file

@ -6,16 +6,16 @@ import signal
import subprocess
import sys
import traceback
from types import FrameType
from typing import Optional
sys.path[:0] = [os.path.dirname(__file__)]
from zephyr_mirror_backend import parse_args
(options, args) = parse_args()
from types import FrameType
def die(signal: int, frame: FrameType) -> None:
def die(signal: int, frame: Optional[FrameType]) -> None:
# We actually want to exit, so run os._exit (so as not to be caught and restarted)
os._exit(1)

View file

@ -1238,7 +1238,7 @@ def parse_args() -> Tuple[optparse.Values, List[str]]:
return parser.parse_args()
def die_gracefully(signal: int, frame: FrameType) -> None:
def die_gracefully(signal: int, frame: Optional[FrameType]) -> None:
if CURRENT_STATE == States.ZulipToZephyr:
# this is a child process, so we want os._exit (no clean-up necessary)
os._exit(1)