New submission from Pascal Chambon <chambon.pas...@gmail.com>:

In test_fileio, one of the tests wants to ensure writing to closed raw streams 
fails, but it actually tries to write an unicode string, which should rather 
lead to an immediate TypeError.

Here is a tiny patch to prevent the "double error cause" danger - this test is 
bugging me because my own I/O library cant pass the stdlib io tests in this 
case.

The initial problem here is that we can't write unicode to a buffered binary 
stream (TypeError), but we can do it with an unbufferred raw stream - as the C 
implementation of the latter does string coercion instead of raising TypeError.
Shouldn't we unify the behaviour of binary streams in such cases ?

----------
components: IO
files: test_fileio_errclosedonwrite.patch
keywords: patch
messages: 106053
nosy: pakal
priority: normal
severity: normal
status: open
title: Tests unwillingly writing unicocde to raw streams
versions: Python 2.7
Added file: http://bugs.python.org/file17400/test_fileio_errclosedonwrite.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to