Skip to content

Popen() object stdout attribute reassignment behaviour #47937

Description

@vincentlegoll
BPO 3687
Nosy @birkenfeld, @terryjreedy, @giampaolo, @maaz92, @iritkatriel

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 = None
closed_at = None
created_at = <Date 2008-08-26.15:57:45.065>
labels = ['3.11', 'type-bug', '3.9', '3.10', 'docs']
title = 'Popen() object stdout attribute reassignment behaviour'
updated_at = <Date 2021-12-05.15:57:52.556>
user = 'https://bugs.python.org/vincentlegoll'

bugs.python.org fields:

activity = <Date 2021-12-05.15:57:52.556>
actor = 'iritkatriel'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2008-08-26.15:57:45.065>
creator = 'vincent.legoll'
dependencies = []
files = []
hgrepos = []
issue_num = 3687
keywords = []
message_count = 5.0
messages = ['71983', '107970', '107976', '281545', '407713']
nosy_count = 7.0
nosy_names = ['georg.brandl', 'terry.reedy', 'giampaolo.rodola', 'vlegoll', 'vincent.legoll', 'maaz92', 'iritkatriel']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue3687'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

Linked PRs

Activity

  1. vincentlegoll commented on Aug 26, 2008

    vincentlegollmannequin
    MannequinAuthor

    The 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

  2. added
    docsDocumentation in the Doc dir
    type-bugAn unexpected behavior, bug, or error
    on Aug 26, 2008
  3. terryjreedy commented on Jun 17, 2010

    @terryjreedy
    Member

    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?

  4. vlegoll commented on Jun 17, 2010

    vlegollmannequin
    Mannequin

    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.

  5. maaz92 commented on Nov 23, 2016

    maaz92mannequin
    Mannequin

    Hi, I want to update the doc for this. This will be my first attempt to update the documentation.

  6. iritkatriel commented on Dec 5, 2021

    @iritkatriel
    Member

    The situation is the same in 3.11, both doc and implementation.

  7. added
    3.11only security fixes
    and removed on Dec 5, 2021
  8. transferred this issue fromon Apr 10, 2022
  9. added
    3.12only security fixes
    and removed on Feb 2, 2023
  10. added a commit that references this issue on Feb 8, 2023
  11. added 3 commits that reference this issue on Feb 8, 2023
  12. added 2 commits that reference this issue on Feb 8, 2023
  13. added a commit that references this issue on Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10 (EOL)end of life3.11only security fixes3.12only security fixesdocsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions