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.
This commit is contained in:
nesquena-hermes committed 2026-09-12 03:03:10 +00:00
1 parent c8a443454c
commit c10bbd8e33
1 file changed
+5 -5
+5 -5
View File
@@ -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()