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: subprocess.Popen: Confusing documentation for restore_signals
Type: Stage:
Components: Library (Lib) Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, gregory.p.smith, ntrrgc, r.david.murray
Priority: normal Keywords:

Created on 2018-03-02 17:31 by ntrrgc, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg313146 - (view) Author: Alicia Boya García (ntrrgc) Date: 2018-03-02 17:31
The docs state:

> If restore_signals is true (the default) all signals that Python has set to SIG_IGN are restored to SIG_DFL in the child process before the exec. Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals. (POSIX only)

The first phrase and the second may seem contradictory for anyone that uses signal handling in their code.

I would definitely not describe the set of "SIGPIPE, SIGXFZ and SIGXFSZ" as "all signals that Python has set". It actually means "all the signals that Python set at startup"; the user could have changed different signals than these (e.g. SIGINT) for various purposes (e.g. not getting a KeyboardInterrupt while an interactive process is running).

The current wording may suggest that all signals changed by the user are reset in the child process, but this is not the case -- I could confirm by looking at _Py_RestoreSignals(). Only these three specific signals are restored.
msg313630 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2018-03-12 00:49
Well, I imagine the original author thought of "python" as python itself, not the user's python program.  That's certainly how I understood it when I read it in your message.  It would not be a bad thing to clarify that, though.
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77166
2018-03-12 00:49:50r.david.murraysetnosy: + r.david.murray
messages: + msg313630
2018-03-02 20:48:16ned.deilysetnosy: + gregory.p.smith, giampaolo.rodola
2018-03-02 17:31:25ntrrgccreate