Message387388
In your code, huge data passed to .write(huge) may be remained in the internal buffer.
```
[NEW PRE-FLUSH]
else if ((self->pending_bytes_count + bytes_len) > self->chunk_size) {
if (_textiowrapper_writeflush(self) < 0) {
Py_DECREF(b);
return NULL;
}
self->pending_bytes = b;
}
(snip)
self->pending_bytes_count += bytes_len;
if (self->pending_bytes_count > self->chunk_size || needflush ||
text_needflush) {
if (_textiowrapper_writeflush(self) < 0)
return NULL;
}
```
In my opinion, when .write(huge) fails with MemoryError, TextIOWrapper must not keep the `huge` in the internal buffer.
See my PR-24592. |
|
Date |
User |
Action |
Args |
2021-02-20 04:53:52 | methane | set | recipients:
+ methane, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, Ramin Farajpour Cami |
2021-02-20 04:53:52 | methane | set | messageid: <1613796832.36.0.750242462837.issue43260@roundup.psfhosted.org> |
2021-02-20 04:53:52 | methane | link | issue43260 messages |
2021-02-20 04:53:52 | methane | create | |
|