[New-bugs-announce] [issue31479] Always reset the signal alarm on unit tests

STINNER Victor report at bugs.python.org
Thu Sep 14 17:33:50 EDT 2017

New submission from STINNER Victor:

While fixing bpo-17085 on Python 2.7 (test_socket: cancel scheduled alarm on test failure), I noticed that not all unit tests currently always reset the signal alarm.

I propose to always use the pattern "try/finally: signal.alarm(0)" to make sure that a test doesn't "leak" a pending fatal signal alarm.

Attached PR fixes the issue.

I don't think that it's worth it to backport the fix, since it only impacts tests which fail, interrupted manually by CTRL+c or other corner cases.

components: Tests
messages: 302213
nosy: haypo
priority: normal
severity: normal
status: open
title: Always reset the signal alarm on unit tests
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list