Message262772
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. |
|
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 | |
|