Comment 3 for bug 1570388

Revision history for this message
scoder (scoder) wrote :

This should improve the situation:
https://github.com/lxml/lxml/commit/cfceec54a8d5b684e2572b02addf0adf5e786f2f
While it's still possible that the serialised data size hits exactly -1 on integer wrap-around, it's much less likely than hitting a negative number.

I think it might be possible to further improve this by matching up more closely with what libxml2 does in its xmlOutputBufferClose() and looking at the buffer error state before calling it. PR welcome for that. Probably worth a helper function that wraps the call.