Author Oren Milman
Recipients Oren Milman, ncoghlan, serhiy.storchaka, veky
Date 2017-08-26.08:09:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1503734968.19.0.875544407965.issue31271@psf.upfronthosting.co.za>
In-reply-to
Content
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_SIZE',
which is just 'Py_SIZE(op)'.

and so, in 2.7 there isn't an assertion failure. Moreover,
'self->pending_bytes_count' is used only to determine whether a flush is needed.
so ISTM that probably the bug's only risk is not flushing automatically after
writing.
note that whenever _textiowrapper_writeflush() is finally called (when the
encoder returned a non-string object), it would raise a TypeError by calling
string_join() on a non-string object.

do you still think we should backport to 2.7?
History
Date User Action Args
2017-08-26 08:09:28Oren Milmansetrecipients: + Oren Milman, ncoghlan, serhiy.storchaka, veky
2017-08-26 08:09:28Oren Milmansetmessageid: <1503734968.19.0.875544407965.issue31271@psf.upfronthosting.co.za>
2017-08-26 08:09:28Oren Milmanlinkissue31271 messages
2017-08-26 08:09:27Oren Milmancreate