Repository navigation
Popen() object stdout attribute reassignment behaviour #47937
Description
Activity
vincentlegoll commented
on Aug 26, 2008 vincentlegollmannequinMannequinAuthorMore actionsThe subprocess.Popen() object documentation should indicate
that the stdout attribute should not be modified after
object construction. Because that won't work.Or the attribute may be rendered read-only
>> from subprocess import Popen, PIPE
>> import sys, os
>> p1 = Popen(["echo", "1"], stdout = PIPE)
>> p2 = Popen(["cat"], stdin = p1.stdout, stderr = PIPE, stdout = PIPE)
>> p2.stdout = sys.stdout
>> print p2.communicate()This blocks forever
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 26, 2008 While it could be argued that it is 'obvious' that changing the stdin, stdout, stderr, and pid of a processes cannot work, I agree that a small addition would be good. In 17.1.2. Popen Objects, after "The following attributes are also available", insert " (do not try to change them)" before ':'.
Actually, it seems to me that the attributes should actually be read-only (in 3.2) if possible (via custom Popen.__setattr__), in which case the only doc change needed (for 3.2) would be insertion of 'read-only' before 'attributes'.
Georg, if you know the id of the subprocess maintainer (if there is one now), could you add him to the nosy list for an opinion or comment?
On Thu, Jun 17, 2010 at 2:34 AM, Terry J. Reedy <report@bugs.python.org> wrote:
While it could be argued that it is 'obvious'
What is obvious for someone maybe is not for others, if I tried to modify it,
that was on the (false) assumption that it will do what I wanted (whatever
that is)...Adding more precision to documentation or making the interface fool proof
will make life of dumb devs like me easier by not having to guess or try.Thanks for taking care of this.
Hi, I want to update the doc for this. This will be my first attempt to update the documentation.
The situation is the same in 3.11, both doc and implementation.
- added3.9 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixesand removed3.7 (EOL)end of lifeend of life
on Dec 5, 2021 - added3.12only security fixesonly security fixesand removed3.9 (EOL)end of lifeend of life
on Feb 2, 2023 - added a commit that references this issue
on Feb 8, 2023 - added 3 commits that reference this issue
on Feb 8, 2023 - added a commit that references this issue
on Feb 9, 2023
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:
bugs.python.org fields:
Linked PRs