You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Misleading stating, that SIGINT handler is installed by default #72981
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-05-07.15:29:33.044>created_at=<Date2016-11-24.22:25:57.469>labels= ['type-bug', '3.7', 'docs']
title='Misleading stating, that SIGINT handler is installed by default'updated_at=<Date2019-05-07.15:55:42.758>user='https://bugs.python.org/JanVeleck'
Hello,
documentation (https://docs.python.org/2/library/signal.html) states, that Python by default installs SIGINT handler which cause KeyboardInterrupt. This is not true everytime according to implementation.
"Python installs a small number of signal handlers by default: SIGPIPE ... and SIGINT is translated into a KeyboardInterrupt exception."
It should also mention this "SIGINT is installed only, when default handler is set at startup.". Because user can run python script from non-interative shell as background task and SIGINT handler is not installed, regardless although user does not change Python default behaviour.
Python installs a small number of signal handlers by default: SIGPIPE is ignored (so write errors on pipes and sockets can be reported as ordinary Python exceptions) and SIGINT (if parent process has not changed it) is translated into a KeyboardInterrupt exception. All of these can be overridden.
Activity
JanVeleck commentedon Nov 24, 2016
Hello,
documentation (https://docs.python.org/2/library/signal.html) states, that Python by default installs SIGINT handler which cause KeyboardInterrupt. This is not true everytime according to implementation.
"Python installs a small number of signal handlers by default: SIGPIPE ... and SIGINT is translated into a KeyboardInterrupt exception."
It should also mention this "SIGINT is installed only, when default handler is set at startup.". Because user can run python script from non-interative shell as background task and SIGINT handler is not installed, regardless although user does not change Python default behaviour.
Related SO:
http://stackoverflow.com/questions/40775054/capturing-sigint-using-keyboardinterrupt-exception-works-in-terminal-not-in-scr/40785230?noredirect=1
JulienPalard commentedon Nov 25, 2016
Maybe something like:
JanVeleck commentedon Nov 25, 2016
That's good.
JulienPalard commentedon Nov 29, 2016
Proposed as patches but english is not my native language so please review carefully.
JulienPalard commentedon May 7, 2019
New changeset e85ef7a by Julien Palard in branch 'master':
bpo-28795: Signal documentation: Fix misleading statement. (GH-13121)
e85ef7a
JulienPalard commentedon May 7, 2019
Thanks for reporting Jan! It's finally merged \o/
miss-islington commentedon May 7, 2019
New changeset 721729f by Miss Islington (bot) in branch '3.7':
bpo-28795: Signal documentation: Fix misleading statement. (GH-13121)
721729f