[issue24126] newlines attribute does not get set after calling readline()

2020-05-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Python 2.7 is no longer supported.

--
nosy: +serhiy.storchaka
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24126] newlines attribute does not get set after calling readline()

2015-05-05 Thread Davide Mancusi

Davide Mancusi added the comment:

For completeness, here is some versioning information:

$ python
Python 2.7 (r27:82500, Mar 23 2015, 16:46:39) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> print sysconfig.get_config_var('CONFIG_ARGS')   
>>> 
>>> 
>>>
'--prefix=/opt/python2.7' '--enable-shared'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24126] newlines attribute does not get set after calling readline()

2015-05-05 Thread Davide Mancusi

New submission from Davide Mancusi:

I have a text file with Windows-style line terminators (\r\n) which I open in 
universal newlines mode. I would expect the newlines attribute to be set after 
the first call to the readline() method, but apparently this is not the case:

>>> f=open('test_crlf', 'rU')
>>> f.newlines
>>> f.readline()
'foo\n'
>>> f.newlines
>>> f.readline()
'bar\n'
>>> f.newlines
'\r\n'

On the other hand, the newlines attribute gets set after the first call to 
readline() on a file with Unix-style line endings.

Also, surprisingly, calling tell() after the first readline() is enough to 
update the newlines attribute:

>>> f=open('test_crlf', 'rU')
>>> f.newlines
>>> f.readline()
'foo\n'
>>> f.newlines
>>> f.tell()
77
>>> f.newlines
'\r\n'

Are these behaviours intended? If so, they should probably be documented.

--
components: IO
messages: 242593
nosy: arekfu
priority: normal
severity: normal
status: open
title: newlines attribute does not get set after calling readline()
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com