@@ -2995,6 +2995,8 @@ _PyBytes_FromList(PyObject *x)
29952995 }
29962996 char * str = PyBytesWriter_GetData (writer );
29972997 size = _PyBytesWriter_GetAllocated (writer );
2998+ str = _PyBytesWriter_ResizeAndUpdatePointer (writer , size , str );
2999+ assert (str != NULL );
29983000
29993001 for (Py_ssize_t i = 0 ; i < PyList_GET_SIZE (x ); i ++ ) {
30003002 PyObject * item = _PyList_GetItemRef ((PyListObject * )x , i );
@@ -3018,6 +3020,8 @@ _PyBytes_FromList(PyObject *x)
30183020 goto error ;
30193021 }
30203022 size = _PyBytesWriter_GetAllocated (writer );
3023+ str = _PyBytesWriter_ResizeAndUpdatePointer (writer , size , str );
3024+ assert (str != NULL );
30213025 }
30223026 * str ++ = (char ) value ;
30233027 }
@@ -3077,6 +3081,8 @@ _PyBytes_FromIterator(PyObject *it, PyObject *x)
30773081 }
30783082 char * str = PyBytesWriter_GetData (writer );
30793083 size = _PyBytesWriter_GetAllocated (writer );
3084+ str = _PyBytesWriter_ResizeAndUpdatePointer (writer , size , str );
3085+ assert (str != NULL );
30803086
30813087 /* Run the iterator to exhaustion */
30823088 for (i = 0 ; ; i ++ ) {
@@ -3111,6 +3117,8 @@ _PyBytes_FromIterator(PyObject *it, PyObject *x)
31113117 goto error ;
31123118 }
31133119 size = _PyBytesWriter_GetAllocated (writer );
3120+ str = _PyBytesWriter_ResizeAndUpdatePointer (writer , size , str );
3121+ assert (str != NULL );
31143122 }
31153123 * str ++ = (char ) value ;
31163124 }
0 commit comments