Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement subprocess.Popen.__repr__ #82905

Closed
cool-RR mannequin opened this issue Nov 6, 2019 · 8 comments
Closed

Implement subprocess.Popen.__repr__ #82905

cool-RR mannequin opened this issue Nov 6, 2019 · 8 comments
Labels
3.9 only security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@cool-RR
Copy link
Mannequin

cool-RR mannequin commented Nov 6, 2019

BPO 38724
Nosy @rhettinger, @gpshead, @pitrou, @taleinat, @cool-RR, @jsnklln, @mdebi
PRs
  • bpo-38724: Implement subprocess.Popen.__repr__ #17151
  • 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 = <Date 2019-11-17.14:09:40.236>
    created_at = <Date 2019-11-06.19:44:32.375>
    labels = ['easy', 'type-feature', 'library', '3.9']
    title = 'Implement subprocess.Popen.__repr__'
    updated_at = <Date 2019-11-17.14:09:40.234>
    user = 'https://github.com/cool-RR'

    bugs.python.org fields:

    activity = <Date 2019-11-17.14:09:40.234>
    actor = 'taleinat'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-11-17.14:09:40.236>
    closer = 'taleinat'
    components = ['Library (Lib)']
    creation = <Date 2019-11-06.19:44:32.375>
    creator = 'cool-RR'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38724
    keywords = ['patch', 'easy']
    message_count = 8.0
    messages = ['356149', '356550', '356561', '356564', '356576', '356598', '356810', '356811']
    nosy_count = 7.0
    nosy_names = ['rhettinger', 'gregory.p.smith', 'pitrou', 'taleinat', 'cool-RR', 'Jason.Killen', 'mdebi']
    pr_nums = ['17151']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue38724'
    versions = ['Python 3.9']

    @cool-RR
    Copy link
    Mannequin Author

    cool-RR mannequin commented Nov 6, 2019

    I was working with a Popen object recently in the shell and it was annoying to see the <subprocess.Popen at 0x4f83898> display. It would be nice to get some kind of minimal detail about the Popen, for example its args and return code, if finished.

    @cool-RR cool-RR mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 6, 2019
    @taleinat
    Copy link
    Contributor

    I agree that this could be nice. A PR (with tests!) would be welcome!

    @taleinat taleinat added the easy label Nov 13, 2019
    @jsnklln
    Copy link
    Mannequin

    jsnklln mannequin commented Nov 13, 2019

    I think this sounds great and I'll take a crack at it over the next few days. If anybody wants to jump ahead of me I don't mind.

    @rhettinger
    Copy link
    Contributor

    +1 for a more informative repr (like we did with regex match objects).

    There are a lot of parameters to subprocess.Popen(). RR is on the right track suggesting that only a small, useful subset of those be included: args and the return code.

    We could add the *pid* argument as well, but may be no more useful or attractive than the current repr's object id.

    The repr should be enclosed in angle brackets because it can't recreate the object.

    @mdebi
    Copy link
    Mannequin

    mdebi mannequin commented Nov 14, 2019

    Hi @Jason.Killen. I am new to cpython and would like to try this one out. Thank you.

    @taleinat
    Copy link
    Contributor

    I agree with Raymond, the repr should include the args and return code.

    IMO it should *not* include the pid, for two reasons:

    1. The pid is stale information if the process has finished.
    2. Popen nicely abstracts away the pid, so it is normally not as useful a detail.

    @taleinat
    Copy link
    Contributor

    New changeset 645005e by Tal Einat (Andrey Doroschenko) in branch 'master':
    bpo-38724: Implement subprocess.Popen.__repr__ (GH-17151)
    645005e

    @taleinat
    Copy link
    Contributor

    Thanks for the suggestion Ram, and thanks for PR Andrey!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants