@@ -3821,7 +3821,7 @@ _PyBytesWriter_Init(_PyBytesWriter *writer)
38213821{
38223822 writer -> buffer = NULL ;
38233823 writer -> allocated = 0 ;
3824- writer -> size = 0 ;
3824+ writer -> min_size = 0 ;
38253825 writer -> overallocate = 0 ;
38263826 writer -> use_small_buffer = 0 ;
38273827#ifdef Py_DEBUG
@@ -3874,7 +3874,7 @@ _PyBytesWriter_CheckConsistency(_PyBytesWriter *writer, char *str)
38743874 }
38753875
38763876 start = _PyBytesWriter_AsString (writer );
3877- assert (0 <= writer -> size && writer -> size <= writer -> allocated );
3877+ assert (0 <= writer -> min_size && writer -> min_size <= writer -> allocated );
38783878 /* the last byte must always be null */
38793879 assert (start [writer -> allocated ] == 0 );
38803880
@@ -3897,18 +3897,18 @@ _PyBytesWriter_Prepare(_PyBytesWriter *writer, char *str, Py_ssize_t size)
38973897 return str ;
38983898 }
38993899
3900- if (writer -> size > PY_SSIZE_T_MAX - size ) {
3900+ if (writer -> min_size > PY_SSIZE_T_MAX - size ) {
39013901 PyErr_NoMemory ();
39023902 _PyBytesWriter_Dealloc (writer );
39033903 return NULL ;
39043904 }
3905- writer -> size += size ;
3905+ writer -> min_size += size ;
39063906
39073907 allocated = writer -> allocated ;
3908- if (writer -> size <= allocated )
3908+ if (writer -> min_size <= allocated )
39093909 return str ;
39103910
3911- allocated = writer -> size ;
3911+ allocated = writer -> min_size ;
39123912 if (writer -> overallocate
39133913 && allocated <= (PY_SSIZE_T_MAX - allocated / OVERALLOCATE_FACTOR )) {
39143914 /* overallocate to limit the number of realloc() */
@@ -3957,7 +3957,7 @@ char*
39573957_PyBytesWriter_Alloc (_PyBytesWriter * writer , Py_ssize_t size )
39583958{
39593959 /* ensure that _PyBytesWriter_Alloc() is only called once */
3960- assert (writer -> size == 0 && writer -> buffer == NULL );
3960+ assert (writer -> min_size == 0 && writer -> buffer == NULL );
39613961 assert (size >= 0 );
39623962
39633963 writer -> use_small_buffer = 1 ;
0 commit comments