File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1149,13 +1149,13 @@ PyObject *PyUnicode_EncodeUTF7(const Py_UNICODE *s,
11491149 char * start ;
11501150
11511151 if (size == 0 )
1152- return PyString_FromStringAndSize (NULL , 0 );
1152+ return PyBytes_FromStringAndSize (NULL , 0 );
11531153
1154- v = PyString_FromStringAndSize (NULL , cbAllocated );
1154+ v = PyBytes_FromStringAndSize (NULL , cbAllocated );
11551155 if (v == NULL )
11561156 return NULL ;
11571157
1158- start = out = PyString_AS_STRING (v );
1158+ start = out = PyBytes_AS_STRING (v );
11591159 for (;i < size ; ++ i ) {
11601160 Py_UNICODE ch = s [i ];
11611161
@@ -1221,7 +1221,10 @@ PyObject *PyUnicode_EncodeUTF7(const Py_UNICODE *s,
12211221 * out ++ = '-' ;
12221222 }
12231223
1224- _PyString_Resize (& v , out - start );
1224+ if (PyBytes_Resize (v , out - start )) {
1225+ Py_DECREF (v );
1226+ return NULL ;
1227+ }
12251228 return v ;
12261229}
12271230
You can’t perform that action at this time.
0 commit comments