New submission from Alexandre Vassalotti <alexan...@peadrop.com>: 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> ---------- components: IO, Library (Lib) files: typecheck_init_stringio.diff keywords: patch messages: 89104 nosy: alexandre.vassalotti priority: normal severity: normal stage: patch review status: open title: Better type checking for the arguments of io.StringIO type: behavior versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file14231/typecheck_init_stringio.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6241> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com