This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: readline.c: PyOS_InputHook not protected against SIGWINCH
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: pmpp, vstinner
Priority: normal Keywords:

Created on 2018-11-15 21:56 by pmpp, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pih.py pmpp, 2018-11-15 21:56 crash test PyOS_InputHook
Messages (5)
msg329969 - (view) Author: pmp-p (pmpp) * Date: 2018-11-15 21:56
when using PyOS_InputHook from within readline module
two signals are to be handled SIGINT and SIGWINCH
SIGINT is really usefull in case hook has a problem though in some case it should be nice to prevent it too (async loop in repl background) 

but SIGWINCH is an annoyance and often lead to interpreter crash.

sample file:
 linux crash test under ubuntu bionic python 3.7.1 gcc7

more elaborated test case https://github.com/pmp-p/aioprompt
msg329970 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-15 22:03
Can you please describe what happens and what is the expected behavior?

When I run "python3 pih.py", the script exits immediately and then a get many "kill: (5441) - No such process" errors in bash.
msg329971 - (view) Author: pmp-p (pmpp) * Date: 2018-11-15 22:12
oops
 
use: python3 -i -u -B pih.py 
to run crash test
msg329972 - (view) Author: pmp-p (pmpp) * Date: 2018-11-15 22:18
expected result would look like:

python3.6 -i -u -B pih.py
>>> Segmentation fault (core dumped)
msg329973 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-15 22:32
You don't use properly ctypes. This issue is unrelated to signals. The fix is: HOOKFUNC = CFUNCTYPE(c_char_p,).
History
Date User Action Args
2022-04-11 14:59:08adminsetgithub: 79442
2018-11-15 22:32:33vstinnersetstatus: open -> closed
resolution: not a bug
messages: + msg329973

stage: resolved
2018-11-15 22:18:01pmppsetmessages: + msg329972
2018-11-15 22:12:18pmppsetmessages: + msg329971
2018-11-15 22:03:03vstinnersetnosy: + vstinner
messages: + msg329970
2018-11-15 21:56:03pmppcreate