Issue 1188: universal newlines doesn't identify CRLF during tell() (original) (raw)

tell() will skip the next LF (after a CR sets f_skipnextlf) when universal newline support is enabled; essentially doing part of the work of read(). However it does not identify CRLF as a newline, as read() would, e.g.:

open('/tmp/crlf', 'wb').write('CRLF\r\nEOF') fp = open('/tmp/crlf', 'U') fp.read() 'CRLF\nEOF' fp.newlines # correct when read()ing '\r\n' fp = open('/tmp/crlf', 'U') fp.readline() 'CRLF\n' fp.newlines fp.tell() 6L fp.newlines # tell() skipped ahead.. fp.readline() 'EOF' fp.newlines # ..but never identified CRLF

The following patch makes tell() mark CRLF as a newline in this case, and ensures so with an added test to test_univnewlines.py. It's against trunk, r28227