Skip to content

Commit

Permalink
Fix signal handler types.
Browse files Browse the repository at this point in the history
Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Oct 25, 2023
1 parent 98e23bd commit 2ecabb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion zulip/integrations/jabber/jabber_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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)

Expand Down
6 changes: 3 additions & 3 deletions zulip/integrations/zephyr/zephyr_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
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)

Expand Down
2 changes: 1 addition & 1 deletion zulip/integrations/zephyr/zephyr_mirror_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2ecabb3

Please sign in to comment.