[New-bugs-announce] [issue26350] Windoes: signal doc should state certains signals can't be registered

Giampaolo Rodola' report at bugs.python.org
Fri Feb 12 09:01:43 EST 2016


New submission from Giampaolo Rodola':

I'm not sure whether this is a bug with signal.signal doc or with the function itself, anyway, here goes. On UNIX I'm able to register a signal handler for SIGTERM which is executed when the signal is received. On Windows I'm able to register it but it will never be executed:


import os, signal

def foo(*args):
    print("foo")  # this never gets printed on Windows

signal.signal(signal.SIGTERM, foo)
os.kill(os.getpid(), signal.SIGTERM)


I think signal module doc should be more clear about this. In details, if it is possible to execute a function on SIGTERM if should explain how. If not (and AFAIK it's not possible) it should state that "signal.signal(signal.SIGTERM, foo)" on Windows is a NOOP.

Note: I'm probably missing something but the same thing applies for SIGINT and possibly (all) other signals, so I'm not sure why Windows has signal.signal in the first place. What's its use case on Windows?

----------
messages: 260179
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: Windoes: signal doc should state certains signals can't be registered

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26350>
_______________________________________


More information about the New-bugs-announce mailing list