[issue8765] Tests unwillingly writing unicocde to raw streams

2019-01-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue8765] Tests unwillingly writing unicocde to raw streams

2019-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 1462234baf7398a6b00c0f51905e26caa17d3c60 by Serhiy Storchaka in branch '2.7': [2.7] bpo-8765: Deprecate writing unicode to binary streams in Py3k mode. (GH-11127) https://github.com/python/cpython/commit/1462234baf7398a6b00c0f51905e26caa17d3c

[issue8765] Tests unwillingly writing unicocde to raw streams

2019-01-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +benjamin.peterson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue8765] Tests unwillingly writing unicocde to raw streams

2018-12-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree, that it would be right to accept only binary strings when write to binary stream. But I afraid that it is too late to change this in the 16th bugfix of 2.7. This can break existing code or tests. I suggest to change the behavior only in the Py3k c

[issue8765] Tests unwillingly writing unicocde to raw streams

2018-12-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +10357 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue8765] Tests unwillingly writing unicocde to raw streams

2013-02-02 Thread Ezio Melotti
Changes by Ezio Melotti : -- stage: -> patch review type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: The 3.1 version does it correctly since issue7785, but this was not backported to 2.x. Python 3.x uses the "y*" format code to accept bytes and not unicode; this code does not exist in 2.x, and was replaced with "s*", which accepts unicode. But since the

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Amaury, do you remember if we made this deliberately? -- nosy: +amaury.forgeotdarc ___ Python tracker ___ __

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-22 Thread Ray.Allen
Ray.Allen added the comment: Yes, I saw that, thanks for explanation! So I work a patch against the trunk, including modification of fileio_write(), bufferedwriter_write() and test_fileio.py. -- Added file: http://bugs.python.org/file17436/issue_8765.diff

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: test_fileio and test_io both use "from __future__ import unicode_literals", which means classical string literals construct unicode strings rather than byte strings. So, yes, Pascal is right, this should be corrected (both the tests, and the implementation so

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-21 Thread Pascal Chambon
Pascal Chambon added the comment: yes, but the same tests are used for py3k as well, where "xxx" is interpreted as unicode (2to3 tools dont try to guess if a py2k string intended to be a byte string or an unicode one). -- ___ Python tracker

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-21 Thread Ray.Allen
Ray.Allen added the comment: pakal wrote: """ 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 """ I don't understand. Isn't b'xxx' and 'xxx' the same in py2.x? They are not unicode string, but bytes string.

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-21 Thread Pascal Chambon
Pascal Chambon added the comment: This would require patching separately py2k and py3k visibly... I'll have a look at it when I have time. -- ___ Python tracker ___ _

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Allright, what's the expected behaviour then - implicitly converting > unicode to bytes (like C RawFileIO), or raising a typeerror (like > buffered streams do) ? Sorry, I should have been clearer. The expected behaviour is to raise a TypeError. The new io mod

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-20 Thread Pascal Chambon
Pascal Chambon added the comment: Allright, what's the expected behaviour then - implicitly converting unicode to bytes (like C RawFileIO), or raising a typeerror (like buffered streams do) ? -- ___ Python tracker

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > 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

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-19 Thread R. David Murray
Changes by R. David Murray : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue8765] Tests unwillingly writing unicocde to raw streams

2010-05-19 Thread Pascal Chambon
New submission from Pascal Chambon : 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 - thi