Skip to content

Commit e224751

Browse files
committed
unicode_resize() clears embed_null cache
1 parent 3c4844f commit e224751

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Objects/unicodeobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,7 @@ resize_compact(PyObject *unicode, Py_ssize_t length)
10151015
_PyUnicode_UTF8(unicode) = NULL;
10161016
_PyUnicode_UTF8_LENGTH(unicode) = 0;
10171017
}
1018+
_PyUnicode_STATE(unicode).embed_null = EMBED_NULL_UNKNOWN;
10181019
#ifdef Py_TRACE_REFS
10191020
_Py_ForgetReference(unicode);
10201021
#endif
@@ -1068,6 +1069,7 @@ resize_inplace(PyObject *unicode, Py_ssize_t length)
10681069
_PyUnicode_UTF8(unicode) = NULL;
10691070
_PyUnicode_UTF8_LENGTH(unicode) = 0;
10701071
}
1072+
_PyUnicode_STATE(unicode).embed_null = EMBED_NULL_UNKNOWN;
10711073

10721074
data = (PyObject *)PyObject_Realloc(data, new_size);
10731075
if (data == NULL) {
@@ -11082,6 +11084,7 @@ PyUnicode_Append(PyObject **p_left, PyObject *right)
1108211084
Py_DECREF(left);
1108311085
*p_left = res;
1108411086
}
11087+
assert(_PyUnicode_STATE(*p_left).embed_null == EMBED_NULL_UNKNOWN);
1108511088
assert(_PyUnicode_CheckConsistency(*p_left, 1));
1108611089
return;
1108711090

0 commit comments

Comments
 (0)