}
end:
- _PyString_Resize(&string, s - PyString_AS_STRING(string));
+ if (_PyString_Resize(&string, s - PyString_AS_STRING(string)))
+ return NULL;
return string;
}
UTF-8 bytes may follow. */
}
}
- if (p-buf < newlen)
- _PyString_Resize(&v, p - buf);
+ if (p-buf < newlen && _PyString_Resize(&v, p - buf))
+ goto failed;
return v;
failed:
Py_DECREF(v);
assert(newsize - (p - PyString_AS_STRING(v)) >= 1);
*p++ = quote;
*p = '\0';
- _PyString_Resize(
- &v, (p - PyString_AS_STRING(v)));
+ if (_PyString_Resize(&v, (p - PyString_AS_STRING(v))))
+ return NULL;
return v;
}
}
return input_obj;
}
/* Fix the size of the resulting string */
- if (inlen > 0)
- _PyString_Resize(&result, output - output_start);
+ if (inlen > 0 && _PyString_Resize(&result, output - output_start))
+ return NULL;
return result;
}
if (--rescnt < 0) {
rescnt = fmtcnt + 100;
reslen += rescnt;
- if (_PyString_Resize(&result, reslen) < 0)
+ if (_PyString_Resize(&result, reslen))
return NULL;
res = PyString_AS_STRING(result)
+ reslen - rescnt;
Py_XDECREF(temp);
return PyErr_NoMemory();
}
- if (_PyString_Resize(&result, reslen) < 0) {
+ if (_PyString_Resize(&result, reslen)) {
Py_XDECREF(temp);
return NULL;
}
if (args_owned) {
Py_DECREF(args);
}
- _PyString_Resize(&result, reslen - rescnt);
+ if (_PyString_Resize(&result, reslen - rescnt))
+ return NULL;
return result;
#ifdef Py_USING_UNICODE