This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Better type checking for the arguments of io.StringIO
Type: behavior Stage: resolved
Components: IO, Library (Lib) Versions: Python 3.1, Python 3.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti
Priority: normal Keywords: patch

Created on 2009-06-08 19:47 by alexandre.vassalotti, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
typecheck_init_stringio.diff alexandre.vassalotti, 2009-06-08 19:46
Messages (2)
msg89104 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-06-08 19:46
The included patch makes type checking of the arguments of StringIO
consistent between pyio and io.

>>> import io
>>> io.StringIO(b"hello")
Traceback (most recent call last):
  ...
ValueError: initial_value must be str or None, not bytes
>>> io.StringIO(newline=b"\n")
<_io.StringIO object at 0x7f93d52953d0>
>>> import _pyio as pyio
>>> pyio.StringIO(newline=b"\n")
Traceback (most recent call last):
  ...
TypeError: illegal newline type: <class 'bytes'>

>>> io.StringIO([])
Traceback (most recent call last):
  ...
ValueError: initial_value must be str or None, not list
>>> pyio.StringIO([])
<_pyio.StringIO object at 0x7f93d4942610>
msg90795 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2009-07-22 03:07
Committed in r74157 (branches/py3k).
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50490
2009-07-22 03:07:57alexandre.vassalottisetstatus: open -> closed
resolution: accepted
messages: + msg90795

stage: patch review -> resolved
2009-06-08 20:18:10alexandre.vassalottilinkissue6218 dependencies
2009-06-08 19:47:00alexandre.vassalotticreate