Message262772
| Author |
vstinner |
| Recipients |
serhiy.storchaka, vstinner |
| Date |
2016年04月01日.21:08:02 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1459544882.22.0.237659182074.issue26642@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Patch version 2:
* check if the stream was already "closed" (see below and comment in the patch)
* first replace stream and then close it and DECREF the object
* don't close stdin anymore
> 1. Is there a reason only name is closed, not dunder_name? (Josh's question, but I'm interesting too).
Fixed.
> 2. Is it worth to first replace standard streams with "standard printers", and then close original streams? This allows to log warnings from closing streams.
Fixed.
> 3. "standard printers" are used at startup and at shutdown. Can we reuse some code?
I looked at the code creating standard printer during Python startup: it's just a few lines and it doesn't handle the case when stdout/stderr is already open. I don't think that it's worth to reuse code.
Anyway, with my new patch, the code is much more complex to handle the case if stderr and/or __stderr__ is "closed" (is NULL, None, getting closed attribute raises an error, or closed attribute is false).
> 4. Daemons close standard streams and fileno(stdout) can return unrelevant value.
Fixed. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年04月01日 21:08:02 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka |
| 2016年04月01日 21:08:02 | vstinner | set | messageid: <1459544882.22.0.237659182074.issue26642@psf.upfronthosting.co.za> |
| 2016年04月01日 21:08:02 | vstinner | link | issue26642 messages |
| 2016年04月01日 21:08:02 | vstinner | create |
|