[issue31271] an assertion failure in io.TextIOWrapper.write

2017-11-06 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "You are right. But in any case the test should be fixed for 2.7." Done: I merged Oren's PR 3951. It seems like the bug was fixed in all (maintained) branches, so I close the issue. Thank you again Oren Milman for *reporting* and *fixing* the bug! -

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-11-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 30537698b607d53fa9ce18522abb88469d5814b6 by Victor Stinner (Oren Milman) in branch '2.7': [2.7] bpo-31271: Fix an assertion failure in io.TextIOWrapper.write. (GH-3201) (#3951) https://github.com/python/cpython/commit/30537698b607d53fa9ce18522ab

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-10-11 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3926 stage: backport needed -> patch review ___ Python tracker ___ ___ Python-bugs-list ma

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-10-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You are right. But in any case the test should be fixed for 2.7. -- ___ Python tracker ___ ___ P

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-10-02 Thread Oren Milman
Oren Milman added the comment: I am not sure, but ISTM that it isn't possible for the encoder to return a unicode and not fail later. This is because _textiowrapper_writeflush() would call _io.BytesIO.write() (after it called _PyBytes_Join()), and bytesio_write() calls PyObject_GetBuffer(), whi

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-10-02 Thread Oren Milman
Oren Milman added the comment: sure -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-10-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oren, do you mind to create a backport to 2.7? miss-islington can not handle it. -- stage: patch review -> backport needed ___ Python tracker __

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-09-15 Thread Roundup Robot
Changes by Roundup Robot : -- pull_requests: +3601 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-09-13 Thread Roundup Robot
Changes by Roundup Robot : -- keywords: +patch pull_requests: +3540 stage: backport needed -> patch review ___ Python tracker ___ ___

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 9bcbc6cba385a83cac8f1ff430cad7617184d2bc by Serhiy Storchaka (Oren Milman) in branch '3.6': [3.6] bpo-31271: Fix an assertion failure in io.TextIOWrapper.write. (GH-3201) (#3209) https://github.com/python/cpython/commit/9bcbc6cba385a83cac8f1ff4

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > do you still think we should backport to 2.7? This is not trivial question. On one side, using PyString_GET_SIZE() with non-bytes object definitely is a bug. It is better to catch it earlier rather than hope on failing in the following code. On other side,

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3247 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-26 Thread Oren Milman
Oren Milman added the comment: all three versions do 'self->pending_bytes_count += PyBytes_GET_SIZE(b);', while 'b' is the object the encoder returned. in 3.6 and 3.7, the implementation of PyBytes_GET_SIZE() includes 'assert(PyBytes_Check(op))', but in 2.7, the implementation is 'PyString_GET_

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: needs patch -> backport needed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset a5b4ea15b61e3f3985f4f0748a18f8b888a63532 by Serhiy Storchaka (Oren Milman) in branch 'master': bpo-31271: Fix an assertion failure in io.TextIOWrapper.write. (#3201) https://github.com/python/cpython/commit/a5b4ea15b61e3f3985f4f0748a18f8b888a635

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: May be make an error message more symmetric to the one in the decoder case? -- ___ Python tracker ___

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Nick Coghlan
Nick Coghlan added the comment: The proposed fix looks good to me, but it did make me wonder if we might have a missing check in the other direction as well. However, it looks like that case is already fine: ``` >>> hex_codec = codecs.lookup("hex") >>> hex_codec._is_text_encoding = True >>> t

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Nick Coghlan
Changes by Nick Coghlan : -- versions: +Python 2.7, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nick can be interested in this. -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mai

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-25 Thread Oren Milman
Oren Milman added the comment: As Serhiy pointed out on github, the assertion failure can be easily reproduced by the following: import codecs import io rot13 = codecs.lookup("rot13") rot13._is_text_encoding = True t = io.TextIOWrapper(io.BytesIO(b'foo'), encoding="rot13") t.write('bar') -

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
Oren Milman added the comment: Just checked on current 3.6 on my Windows 10. The assertion failes, and it is in line 1337. oh my. -- ___ Python tracker ___ __

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Vedran Čačić
Vedran Čačić added the comment: I can't reproduce this on 3.6.0. Is this on 3.7 only? -- nosy: +veky ___ Python tracker ___ ___ Python

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
Changes by Oren Milman : -- pull_requests: +3240 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue31271] an assertion failure in io.TextIOWrapper.write

2017-08-24 Thread Oren Milman
New submission from Oren Milman: currently, the following causes an assertion in Modules/_io/textio.c in _io_TextIOWrapper_write_impl() to fail: import codecs import io class BadEncoder(): def encode(self, dummy): return 42 def _get_bad_encoder(dummy): return BadEncoder() quopri