From 059bba8c4f30c4d93b09e3321ffc327b3718c6db Mon Sep 17 00:00:00 2001 From: didericis Date: Thu, 4 Jun 2026 12:12:57 -0400 Subject: [PATCH] fix: make pty_resize sync function callable with no arguments The sync() function is used in two contexts: 1. As a signal handler: signal.signal(signal.SIGWINCH, sync) - Called with (signum: int, frame: FrameType | None) 2. As a threading.Timer callback: Timer(..., sync) - Called with no arguments Made parameters optional with defaults to support both call patterns. Added type: ignore for signal.signal() since the type signature differs. Fixes: TypeError when Timer tries to call sync() with no arguments. Co-Authored-By: Claude Haiku 4.5 --- bot_bottle/backend/smolmachines/pty_resize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot_bottle/backend/smolmachines/pty_resize.py b/bot_bottle/backend/smolmachines/pty_resize.py index cbe303e..cae1664 100644 --- a/bot_bottle/backend/smolmachines/pty_resize.py +++ b/bot_bottle/backend/smolmachines/pty_resize.py @@ -124,13 +124,13 @@ def main(argv: list[str]) -> int: machine = argv[0] inner = argv[2:] - def sync(_signum: int, _frame: FrameType | None) -> None: + def sync(_signum: int | None = None, _frame: FrameType | None = None) -> None: size = _read_winsize() if size is None: return _push_size(machine, *size) - signal.signal(signal.SIGWINCH, sync) + signal.signal(signal.SIGWINCH, sync) # type: ignore[arg-type] proc = subprocess.Popen(inner) # Initial sync is deferred — see _STARTUP_SYNC_DELAY_SEC.