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.

Author serhiy.storchaka
Recipients serhiy.storchaka, vstinner
Date 2016-04-17.20:30:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460925005.51.0.939974944798.issue26642@psf.upfronthosting.co.za>
In-reply-to
Content
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().
History
Date User Action Args
2016-04-17 20:30:05serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner
2016-04-17 20:30:05serhiy.storchakasetmessageid: <1460925005.51.0.939974944798.issue26642@psf.upfronthosting.co.za>
2016-04-17 20:30:05serhiy.storchakalinkissue26642 messages
2016-04-17 20:30:05serhiy.storchakacreate