Message263626
I meant that C files stderr and stdout can be closed. Or it's file descriptors can be closed. I think in these cases fileno() or PyFile_NewStdPrinter() will fail.
I'm trying to consider all possible cases. Standard streams can be:
* Left original.
* Set to None.
* Reopened with different encoding/errors/etc.
* Redirected to a file (/dev/null).
* Redirected to a socket.
* Redirected to inherited file descriptor (pipe) in a subprocess.
* Be a high level wrapper around RPC (IDLE subprocess).
If the stream was reopened with the same file descriptor and closefd=True, closing it invalidates just opened "standard printer".
I would replace stdout and stderr after PyImport_Cleanup(). But PyImport_Cleanup() cleans up the sys module! Thus we should do this inside PyImport_Cleanup(). |
|
Date |
User |
Action |
Args |
2016-04-17 20:30:05 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, vstinner |
2016-04-17 20:30:05 | serhiy.storchaka | set | messageid: <1460925005.51.0.939974944798.issue26642@psf.upfronthosting.co.za> |
2016-04-17 20:30:05 | serhiy.storchaka | link | issue26642 messages |
2016-04-17 20:30:05 | serhiy.storchaka | create | |
|