You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-02-27.05:45:28.919>labels= ['type-feature', 'expert-IO']
title='export the set newline value on TextIOBase/TextIOWrapper'updated_at=<Date2021-03-05.21:03:13.665>user='https://bugs.python.org/calestyo'
It seems there is no way to determine the newline value (None, '', \n, \r, \r\n) of a given text stream.
.newlines rather gives the newlines that have been encountered so far.
Just like .encoding and .errors this would be quite useful for anything that gets a stream and operates on it, possibly needing to know which newlines it will see when reading from the stream.
One example would be, after line = stream.readline(4096+n) one want's to know whether actually a full line of 4096 characters has been read.
Putting aside newline="", for simplicity here, n already depends on whether newline was None, \n, \r or \r\n, as would any check like line.endswith(foo).
Maybe some attribute, that indicates the most recently read newline in newline="" mode, would be helpful, too.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: