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: Opaque default value for close_fds argument in Popen.__init__
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: danishprakash, docs@python, gregory.p.smith, martin.panter, taleinat, Алексей Аверченко
Priority: normal Keywords: easy, patch

Created on 2017-10-19 20:34 by Алексей Аверченко, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11039 closed danishprakash, 2018-12-08 14:59
Messages (9)
msg304642 - (view) Author: Алексей Аверченко (Алексей Аверченко) Date: 2017-10-19 20:34
[11:30:03 ~]$ python
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> help(subprocess.Popen.__init__)
Help on function __init__ in module subprocess:

__init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=<object object at 0x10df99150>, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, encoding=None, errors=None)
    Create new Popen instance.
msg314413 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-03-25 13:47
The close_fds=<object . . .> in that signature seems fine to me. If you read the documentation, it says the default mode depends on the platform, and on other parameters. However I think the signature at <https://docs.python.org/release/3.6.4/library/subprocess.html#subprocess.Popen> should not show close_fds=True, because that is not necessarily the default on Windows.

It seems the default on Windows was changed to always True in 3.7, making it consistent across platforms and other parameters, thanks to Issue 19764. But the 3.7 documentation is quirky. “Changed in version 3.2: The default for ‘close_fds’ was changed from False to what is described above” refers to the 3.7 default when it was meant to refer to the 3.2–3.6 default.
msg322354 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-07-25 14:03
ISTM that the docs need to be fixed for both 3.7+ and for 3.6.

The signature is indeed awkward for 3.6, but it's too minor a detail to address considering it's no longer relevant for 3.7 and later.
msg330297 - (view) Author: Danish Prakash (danishprakash) * Date: 2018-11-23 03:17
I'd like to work on this.

I get that the 3.7+ doc still has the irrelevant change from 3.6 which needs to be removed but I'm not sure what's wrong with the 3.6 doc.

> The signature is indeed awkward for 3.6,
msg330298 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-11-23 05:13
Danish, see Martin's previous comment (msg314413):

"... the signature at [the 3.6 docs] should not show close_fds=True, because that is not necessarily the default on Windows."
msg331527 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-12-10 17:38
In 3.6 this help(subprocess.Popen.__init__) is accurate and encourages looking at the docs.  In 3.7 and later it'll simply report close_fds=True in the siguature as that is the case in 3.7 onwards.

I see nothing to fix here.
msg331680 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-12-12 08:39
Gregory, this issue was about the docs, not the doc-string (help()). Are you sure it should be closed?
msg331721 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-12-12 23:30
Only if someone can point to a concrete problem to be fixed in the 3.7+ docs.  Looking at all references to close_fds in https://docs.python.org/3/library/subprocess.html I don't see one.

(I'm not going to touch the 3.6 docs)
msg331747 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2018-12-13 08:13
The only problem with the 3.7+ documentation is the note about 3.2. Several paragraphs under <https://docs.python.org/release/3.7.1/library/subprocess.html#subprocess.Popen>, it still says

“Changed in version 3.2: The default for ‘close_fds’ was changed from False to what is described above.”

However the description it refers to was removed in 3.6. IMO it would make sense to add the description to the note:

“Changed in version 3.2: The default for ‘close_fds’ was changed from False to True on Unix. On Windows the default was changed from False to True when stdin/stdout/stderr are None.”
History
Date User Action Args
2022-04-11 14:58:53adminsetgithub: 76004
2018-12-13 08:13:06martin.pantersetmessages: + msg331747
2018-12-12 23:30:35gregory.p.smithsetmessages: + msg331721
2018-12-12 08:39:55taleinatsetmessages: + msg331680
2018-12-10 17:38:08gregory.p.smithsetstatus: open -> closed

nosy: + gregory.p.smith
messages: + msg331527

resolution: wont fix
stage: patch review -> resolved
2018-12-10 17:32:07gregory.p.smithsetversions: - Python 3.6
2018-12-08 14:59:08danishprakashsetkeywords: + patch
stage: patch review
pull_requests: + pull_request10276
2018-11-23 05:13:27taleinatsetmessages: + msg330298
2018-11-23 03:17:01danishprakashsetnosy: + danishprakash
messages: + msg330297
2018-07-25 14:03:57taleinatsetassignee: docs@python
components: + Documentation, - Library (Lib)
versions: + Python 3.7, Python 3.8
keywords: + easy
nosy: + docs@python, taleinat

messages: + msg322354
2018-03-25 13:47:31martin.pantersetnosy: + martin.panter
messages: + msg314413
2017-10-19 20:34:16Алексей Аверченкоcreate