New submission from
Philip Jenvey
:
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
----------
components: Library (Lib)
files: univnewline_tell-r58227.diff
messages: 56085
nosy: pjenvey
severity: normal
status: open
title: universal newlines doesn't identify CRLF during tell()
versions: Python 2.6
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1188>
__________________________________
univnewline_tell-r58227.diff
Description: Binary data
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
