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 <[email protected]>
<http://bugs.python.org/issue26350>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com