Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1912b39

Browse files
committed
_PyUnicodeWriter_WriteStr() now checks that the input string is consistent
in debug mode to detect bugs earlier. _PyUnicodeWriter_Finish() doesn't check if the read only string is consistent, whereas it does check consistency for strings built by itself.
1 parent aa4c36f commit 1912b39

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Objects/unicodeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13422,6 +13422,7 @@ _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, PyObject *str)
1342213422
maxchar = PyUnicode_MAX_CHAR_VALUE(str);
1342313423
if (maxchar > writer->maxchar || len > writer->size - writer->pos) {
1342413424
if (writer->buffer == NULL && !writer->overallocate) {
13425+
assert(_PyUnicode_CheckConsistency(str, 1));
1342513426
writer->readonly = 1;
1342613427
Py_INCREF(str);
1342713428
writer->buffer = str;

0 commit comments

Comments
 (0)