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 rbcollins
Recipients rbcollins
Date 2013-03-12.03:12:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
the docs ( do not document closefd, and AFAICT it isn't possible to tell if closefd is set after the object is created. Specifically it does not show up in the repr().

>>> import sys
>>> sys.stdout
<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
>>> sys.stdout.buffer
<_io.BufferedWriter name='<stdout>'>
>>> sys.stdout.buffer.raw
<_io.FileIO name='<stdout>' mode='wb'>

If one wants to reopen sys.std in non-buffered mode, the right thing to do according to a recent thread on python-ideas is to use fdopen - e.g.

mystream =, 'wt', 0) 
but this will set closefd to True in the new object, which results in hilarity when it gets garbage collected. And you cannot tell or compare that to the original stdout because of the lack of exposure of this attribute and it's implications. (Does it close the fd on __del__? After each operation? On close() being called on the FileIO object?)
Date User Action Args
2013-03-12 03:12:07rbcollinssetrecipients: + rbcollins
2013-03-12 03:12:07rbcollinssetmessageid: <>
2013-03-12 03:12:07rbcollinslinkissue17401 messages
2013-03-12 03:12:05rbcollinscreate