Author martin.panter
Recipients James Hennessy, martin.panter, r.david.murray, serhiy.storchaka
Date 2016-04-19.03:54:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
According to Issue 12215, the TextIOWrapper.tell() position only includes decoder state, not encoder state. So we may be lucky that tell() is proportional to the file size. If so my concern about max_size isn’t so important. But it still feels like a bad hack.

Maybe another quick fix for this would be to do two writes of the StringIO data, and then seek back to the end of the first write:

pos = file.tell()  # StringIO position is in code points
pos = newfile.tell()  # TextIOWrapper position is opaque
newfile.write(, 0)

This still depends on StringIO.tell() corresponding to the number of code points, which is undocumented (we already disable newline translation in the StringIO). See also Issue 25190.
Date User Action Args
2016-04-19 03:54:13martin.pantersetrecipients: + martin.panter, r.david.murray, serhiy.storchaka, James Hennessy
2016-04-19 03:54:12martin.pantersetmessageid: <>
2016-04-19 03:54:12martin.panterlinkissue26730 messages
2016-04-19 03:54:12martin.pantercreate