From c10bbd8e33bbfb1515294ae055ebe63e594a7d1c Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Sat, 12 Sep 2026 03:03:10 +0000 Subject: [PATCH] stage-fix(#7315): keep explicit signal.SIGTERM literal + add SIGINT within 749-line budget Two tests pin opposite constraints on server.py: test_sprint10 requires <750 lines, and test_issue5543 AST-asserts a signal.signal() call whose first arg literal is signal.SIGTERM. The loop refactor satisfied the size budget but the loop var _sig failed the AST literal check. Register both signals explicitly in one shared try/except: keeps the SIGTERM literal, adds SIGINT (#7078), stays at 749 lines. --- server.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index 03af1068..364d5988 100644 --- a/server.py +++ b/server.py @@ -714,11 +714,11 @@ def main() -> None: daemon=True, ).start() - for _sig in (signal.SIGTERM, signal.SIGINT): # SIGINT: Ctrl-C / ctl.sh daemons (#7078) - try: - signal.signal(_sig, _request_shutdown) - except (ValueError, OSError): - logger.debug("Could not install %s handler", _sig, exc_info=True) + try: + signal.signal(signal.SIGTERM, _request_shutdown) + signal.signal(signal.SIGINT, _request_shutdown) # Ctrl-C / ctl.sh daemons (#7078) + except (ValueError, OSError): + logger.debug("Could not install shutdown signal handlers", exc_info=True) try: httpd.serve_forever()