Issue38724
Created on 2019-11-06 19:44 by cool-RR, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 17151 | merged | python-dev, 2019-11-14 10:30 | |
| Messages (8) | |||
|---|---|---|---|
| msg356149 - (view) | Author: Ram Rachum (cool-RR) * | Date: 2019-11-06 19:44 | |
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. |
|||
| msg356550 - (view) | Author: Tal Einat (taleinat) * | Date: 2019-11-13 19:48 | |
I agree that this could be nice. A PR (with tests!) would be welcome! |
|||
| msg356561 - (view) | Author: Jason Killen (Jason.Killen) * | Date: 2019-11-13 21:57 | |
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. |
|||
| msg356564 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2019-11-13 22:27 | |
+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. |
|||
| msg356576 - (view) | Author: Debi Mishra (mdebi) * | Date: 2019-11-14 05:04 | |
Hi @Jason.Killen. I am new to cpython and would like to try this one out. Thank you. |
|||
| msg356598 - (view) | Author: Tal Einat (taleinat) * | Date: 2019-11-14 11:22 | |
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. |
|||
| msg356810 - (view) | Author: Tal Einat (taleinat) * | Date: 2019-11-17 14:09 | |
New changeset 645005e947c13c4a0706310a2a46112bf63cadc0 by Tal Einat (Andrey Doroschenko) in branch 'master': bpo-38724: Implement subprocess.Popen.__repr__ (GH-17151) https://github.com/python/cpython/commit/645005e947c13c4a0706310a2a46112bf63cadc0 |
|||
| msg356811 - (view) | Author: Tal Einat (taleinat) * | Date: 2019-11-17 14:09 | |
Thanks for the suggestion Ram, and thanks for PR Andrey! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:22 | admin | set | github: 82905 |
| 2019-11-17 14:09:40 | taleinat | set | status: open -> closed resolution: fixed messages: + msg356811 stage: patch review -> resolved |
| 2019-11-17 14:09:04 | taleinat | set | messages: + msg356810 |
| 2019-11-14 11:22:38 | taleinat | set | messages: + msg356598 |
| 2019-11-14 10:30:39 | python-dev | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request16660 |
| 2019-11-14 05:04:49 | mdebi | set | nosy:
+ mdebi messages: + msg356576 |
| 2019-11-13 22:27:08 | rhettinger | set | nosy:
+ rhettinger messages: + msg356564 |
| 2019-11-13 21:57:18 | Jason.Killen | set | messages: + msg356561 |
| 2019-11-13 20:30:37 | taleinat | set | stage: needs patch |
| 2019-11-13 19:48:21 | taleinat | set | keywords:
+ easy messages: + msg356550 |
| 2019-11-13 19:35:50 | Jason.Killen | set | nosy:
+ Jason.Killen |
| 2019-11-06 19:46:00 | ammar2 | set | nosy:
+ gregory.p.smith |
| 2019-11-06 19:45:07 | cool-RR | set | nosy:
+ taleinat |
| 2019-11-06 19:44:32 | cool-RR | create | |