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.
Created on 2011年04月30日 15:49 by eric.araujo, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (8) | |||
|---|---|---|---|
| msg134870 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年04月30日 15:49 | |
Previous to 3.2, os.popen was made a context manager thanks to a private helper, os._wrap_close (contextlib.closing was maybe unavailable due to a bootstrapping issue). Now that subprocess.Popen directly implements the context manager protocol, this could be cleaned up. |
|||
| msg134921 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年05月01日 19:21 | |
Have you seen the comment on top of it? It says "Helper for popen() -- a proxy for a file whose close waits for the process". |
|||
| msg135202 - (view) | Author: Chris Rose (offby1) * | Date: 2011年05月05日 13:58 | |
I'm pretty sure that the os._wrap_close wrapper is not the same thing as the Popen context manager. I don't think it's useful to try refactor this. As Antoine points out, the current wrapper serves a very different purpose. |
|||
| msg135212 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月05日 15:39 | |
Looks like I’ve misunderstood and there is no duplication. If you feel sure about it, please reject and close this report. |
|||
| msg135905 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月13日 13:17 | |
After #12044, subprocess.Popen.__exit__ waits for process completion and closes streams. Doesn’t that make wrap_close obsolete? |
|||
| msg185568 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2013年03月30日 15:30 | |
So is _wrap_close obsolete or not? |
|||
| msg190177 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年05月28日 06:53 | |
Mark: if you know Python you can answer that question yourself by reading the code of the subprocess and os modules. From a fairly short glance at the code I'd say that _wrap_close is not obsolete. It is a wrapper about a file object for the stdout or stdin stream of a Popen object (depending on the last argument of os.popen), and when _wrap_close.close is called it closes the wrapped stream, then waits for the subprocess to die and returns a *transformation* of the exitcode attribute. If my interpretation of the _wrap_close is correct this issue can be closed as invalid (the code cannot be cleaned up without changing functionality) |
|||
| msg202284 - (view) | Author: A.M. Kuchling (akuchling) * (Python committer) | Date: 2013年11月06日 19:47 | |
Closing this issue; I agree with Ronald's assessment. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:16 | admin | set | github: 56174 |
| 2013年11月06日 19:47:54 | akuchling | set | status: open -> closed nosy: + akuchling messages: + msg202284 resolution: not a bug |
| 2013年05月28日 06:53:27 | ronaldoussoren | set | nosy:
+ ronaldoussoren messages: + msg190177 versions: + Python 3.4, - Python 3.2 |
| 2013年03月30日 15:30:57 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg185568 |
| 2011年05月13日 13:17:11 | eric.araujo | set | messages: + msg135905 |
| 2011年05月05日 15:39:04 | eric.araujo | set | messages: + msg135212 |
| 2011年05月05日 13:58:06 | offby1 | set | nosy:
+ offby1 messages: + msg135202 |
| 2011年05月01日 19:21:28 | pitrou | set | nosy:
+ pitrou messages: + msg134921 |
| 2011年04月30日 15:49:30 | eric.araujo | create | |