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 eryksun
Recipients eryksun, kbrazil
Date 2021-10-27.16:43:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1635353006.6.0.300062999736.issue45617@roundup.psfhosted.org>
In-reply-to
Content
> like those returned by the open() function. Their parameters are 
> chosen as follows..."

The `newline` argument for sys.std* isn't documented, but it should be. It happens to be newline='\n' on every platform except Windows.

> its newlines attribute is set to None

The `newlines` attribute is based on the `newlines` attribute of the incremental decoder. It defaults to None if the decoder lacks this attribute. AFAIK, only the universal newlines decoder, io.IncrementalNewlineDecoder, implements this attribute. If it's not None, the value is a string or tuple that tracks the types of newlines that have been seen thus far. For example:

    >>> fdr, fdw = os.pipe()
    >>> f = open(fdr, 'r', newline=None, closefd=False)
    >>> os.write(fdw, b'a\r\n')
    3
    >>> f.readline()
    'a\n'
    >>> f.newlines
    '\r\n'
    >>> os.write(fdw, b'a\n')
    2
    >>> f.readline()
    'a\n'
    >>> f.newlines
    ('\n', '\r\n')
History
Date User Action Args
2021-10-27 16:43:27eryksunsetrecipients: + eryksun, kbrazil
2021-10-27 16:43:26eryksunsetmessageid: <1635353006.6.0.300062999736.issue45617@roundup.psfhosted.org>
2021-10-27 16:43:26eryksunlinkissue45617 messages
2021-10-27 16:43:26eryksuncreate