[issue28795] Misleading stating, that SIGINT handler is installed by default
New submission from Jan Velecký: 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-keyboardi... ---------- assignee: docs@python components: Documentation messages: 281664 nosy: Jan Velecký, docs@python priority: normal severity: normal status: open title: Misleading stating, that SIGINT handler is installed by default type: behavior versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28795> _______________________________________
Julien Palard added the comment: Maybe something like:
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.
---------- nosy: +mdk _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28795> _______________________________________
Jan Velecký added the comment: That's good. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28795> _______________________________________
Julien Palard added the comment: Proposed as patches but english is not my native language so please review carefully. ---------- keywords: +patch Added file: http://bugs.python.org/file45695/issue28795-tip.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28795> _______________________________________
Changes by Julien Palard <julien+python@palard.fr>: Added file: http://bugs.python.org/file45696/issue28795-2.7.diff _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28795> _______________________________________
Change by Julien Palard <julien+python@palard.fr>: ---------- pull_requests: +13034 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
Julien Palard <julien+python@palard.fr> added the comment: New changeset e85ef7a7eacdef2f43e6bf2e67f335100e7ef2da by Julien Palard in branch 'master': bpo-28795: Signal documentation: Fix misleading statement. (GH-13121) https://github.com/python/cpython/commit/e85ef7a7eacdef2f43e6bf2e67f335100e7... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +13075 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
Change by Julien Palard <julien+python@palard.fr>: ---------- stage: patch review -> backport needed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
Julien Palard <julien+python@palard.fr> added the comment: Thanks for reporting Jan! It's finally merged \o/ ---------- resolution: -> fixed stage: backport needed -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 721729fca4fab9fd11861844880b3f3780015ae0 by Miss Islington (bot) in branch '3.7': bpo-28795: Signal documentation: Fix misleading statement. (GH-13121) https://github.com/python/cpython/commit/721729fca4fab9fd11861844880b3f37800... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue28795> _______________________________________
participants (3)
-
Jan Velecký -
Julien Palard -
miss-islington