[Python-bugs-list] [Bug #116787] StringIO does not check constructor argument type
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 13 Oct 2000 06:33:36 -0700
Bug #116787, was updated on 2000-Oct-13 06:33
Here is a current snapshot of the bug.
Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: StringIO does not check constructor argument type
Details: Python 2.0c1 (#7, Oct 9 2000, 18:44:43) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.6 -- press F1 for help
>>> import StringIO
>>> file = open("C:/Python20/readme.txt")
>>> fstr = StringIO.StringIO(file.readlines())
# The above line differs from the behavior of cStringIO, which correctly
# reports: "TypeError: expected string, list found"
# Doom is inevitable after this...
>>> len(fstr.getvalue())
838
>>> fstr.readline()
Traceback (innermost last):
File "<pyshell#4>", line 1, in ?
fstr.readline()
File "c:\python20\lib\StringIO.py", line 85, in readline
i = string.find(self.buf, '\n', self.pos)
File "c:\python20\lib\string.py", line 172, in find
return s.find(*args)
AttributeError: find
>>>
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=116787&group_id=5470