[New-bugs-announce] [issue17253] stdin.readline behaviour different between IDLE and the console
Jason R Briggs
report at bugs.python.org
Wed Feb 20 12:45:29 CET 2013
New submission from Jason R Briggs:
The sys.stdin.readline function takes a limit parameter, which limits the number of characters read. If you try using that parameter in IDLE, you get the following error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
sys.stdin.readline(13)
TypeError: readline() takes exactly 1 positional argument (2 given)
I've tried this in a number of different versions and it looks to have been like this for a while. A possible fix looks fairly straightforward. Something vaguely like...
< def readline(self):
---
> def readline(self, limit=-1):
993a994,995
> if limit >= 0:
> line = line[0:limit]
(with apologies if this is a dup ticket -- there seems to be a number of tickets raised regarding issues with IDLE and its version stdin/stdout, but I couldn't see any which discussed this particular behaviour).
----------
components: IDLE
messages: 182488
nosy: jason.briggs
priority: normal
severity: normal
status: open
title: stdin.readline behaviour different between IDLE and the console
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17253>
_______________________________________
More information about the New-bugs-announce
mailing list