You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
C API: Fix PyUnicodeWriter_WriteUTF8() and PyUnicodeWriter_Format() error handling #158439
If PyUnicodeWriter_WriteUTF8() or PyUnicodeWriter_Format() fails, the writer should remain valid and usable for further writes. These functions can change the buffer kind to support write larger character. But if these functions fail, PyUnicodeWriter_Finish() may need to change the buffer kind to use the most efficient storage for the final string.
The fix in the main branch changes the _PyUnicodeWriter structure (to add a new recheck_maxchar member). The structure is private but exposed in the public C API. I prefer to leave the code as it is in 3.14 and 3.15 branches: it's too risky to change the ABI. So I close the issue.
Activity
pythongh-158439: Add _PyUnicodeWriter.recheck_maxchar
pythongh-158439: Add _PyUnicodeWriter.recheck_maxchar
pythongh-158439: Add _PyUnicodeWriter.recheck_maxchar
pythongh-158439: Add _PyUnicodeWriter.recheck_maxchar
gh-158439: Add _PyUnicodeWriter.recheck_maxchar (#158442)
vstinner commentedon Sep 29, 2026
The fix in the main branch changes the
_PyUnicodeWriterstructure (to add a newrecheck_maxcharmember). The structure is private but exposed in the public C API. I prefer to leave the code as it is in 3.14 and 3.15 branches: it's too risky to change the ABI. So I close the issue.