[New-bugs-announce] [issue25482] signal.set_wakeup_fd() doesn't work if the signal don't have handler
Atsuo Ishimoto
report at bugs.python.org
Mon Oct 26 07:34:56 EDT 2015
New submission from Atsuo Ishimoto:
I expect following code prints '\x1c' when I resize terminal window on Linix/Mac terminal.
--------------------------------
import select, os, signal
rfd, wfd = os.pipe()
os.set_blocking(wfd, False)
signal.set_wakeup_fd(wfd)
select.select([rfd], [], [])
print(os.read(rfd, 2))
--------------------------------
Resizing terminal window make SIGWINCH signal sent to Python process. But nothing written to fd I specified to set_wakeup_fd().
I checked Modules/signalmodule.c and found I should assign signal handler for the signal I want to wakeup fd. So following code works as I expected.
--------------------------------
import select, os, signal
rfd, wfd = os.pipe()
os.set_blocking(wfd, False)
signal.set_wakeup_fd(wfd)
signal.signal(signal.SIGWINCH, lambda *args:0)
select.select([rfd], [], [])
print(os.read(rfd, 2))
--------------------------------
Is this an expected behavior of signal.set_wakeup_fd()?
----------
components: Library (Lib)
messages: 253468
nosy: ishimoto
priority: normal
severity: normal
status: open
title: signal.set_wakeup_fd() doesn't work if the signal don't have handler
versions: Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25482>
_______________________________________
More information about the New-bugs-announce
mailing list