unicode_result_unchanged(PyObject *unicode)
{
if (PyUnicode_CheckExact(unicode)) {
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
Py_INCREF(unicode);
return unicode;
if (_PyUnicode_KIND(unicode) != PyUnicode_WCHAR_KIND) {
PyObject *copy;
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
copy = PyUnicode_New(length, PyUnicode_MAX_CHAR_VALUE(unicode));
return -1;
}
- if (PyUnicode_READY(from))
+ if (PyUnicode_READY(from) == -1)
return -1;
- if (PyUnicode_READY(to))
+ if (PyUnicode_READY(to) == -1)
return -1;
how_many = Py_MIN(PyUnicode_GET_LENGTH(from), how_many);
PyErr_BadInternalCall();
return NULL;
}
- if (PyUnicode_READY(unicode))
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
length = PyUnicode_GET_LENGTH(unicode);
void *result;
unsigned int skind;
- if (PyUnicode_READY(s))
+ if (PyUnicode_READY(s) == -1)
return NULL;
len = PyUnicode_GET_LENGTH(s);
str_obj = PyUnicode_DecodeUTF8Stateful(str, strlen(str), "replace", NULL);
if (!str_obj)
goto fail;
- if (PyUnicode_READY(str_obj)) {
+ if (PyUnicode_READY(str_obj) == -1) {
Py_DECREF(str_obj);
goto fail;
}
/* XXX Perhaps we should make this API an alias of
PyObject_Str() instead ?! */
if (PyUnicode_CheckExact(obj)) {
- if (PyUnicode_READY(obj))
+ if (PyUnicode_READY(obj) == -1)
return NULL;
Py_INCREF(obj);
return obj;
return 1;
}
if (PyUnicode_Check(arg)) {
- if (PyUnicode_READY(arg))
+ if (PyUnicode_READY(arg) == -1)
return 0;
output = arg;
Py_INCREF(output);
return 0;
}
}
- if (PyUnicode_READY(output) < 0) {
+ if (PyUnicode_READY(output) == -1) {
Py_DECREF(output);
return 0;
}
}
if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos))
goto onError;
- if (PyUnicode_READY(repunicode) < 0)
+ if (PyUnicode_READY(repunicode) == -1)
goto onError;
/* Copy back the bytes variables, which might have been modified by the
char * out;
char * start;
- if (PyUnicode_READY(str) < 0)
+ if (PyUnicode_READY(str) == -1)
return NULL;
kind = PyUnicode_KIND(str);
data = PyUnicode_DATA(str);
PyErr_BadArgument();
return NULL;
}
- if (PyUnicode_READY(str) < 0)
+ if (PyUnicode_READY(str) == -1)
return NULL;
kind = PyUnicode_KIND(str);
data = PyUnicode_DATA(str);
PyErr_BadArgument();
return NULL;
}
- if (PyUnicode_READY(str) < 0)
+ if (PyUnicode_READY(str) == -1)
return NULL;
kind = PyUnicode_KIND(str);
data = PyUnicode_DATA(str);
PyErr_BadArgument();
return NULL;
}
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
len = PyUnicode_GET_LENGTH(unicode);
kind = PyUnicode_KIND(unicode);
PyErr_BadArgument();
return NULL;
}
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
kind = PyUnicode_KIND(unicode);
data = PyUnicode_DATA(unicode);
return NULL;
}
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
len = PyUnicode_GET_LENGTH(unicode);
* -1=not initialized, 0=unknown, 1=strict, 2=replace, 3=ignore, 4=xmlcharrefreplace */
int known_errorHandler = -1;
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
size = PyUnicode_GET_LENGTH(unicode);
kind = PyUnicode_KIND(unicode);
encoding, reason, unicode, &exc,
collstart, collend, &newpos);
if (repunicode == NULL || (PyUnicode_Check(repunicode) &&
- PyUnicode_READY(repunicode) < 0))
+ PyUnicode_READY(repunicode) == -1))
goto onError;
if (PyBytes_Check(repunicode)) {
/* Directly copy bytes result to output. */
enum PyUnicode_Kind kind;
void *data;
- if (PyUnicode_READY(rep) < 0) {
+ if (PyUnicode_READY(rep) == -1) {
Py_DECREF(rep);
goto error;
}
Py_ssize_t offset;
int chunk_len, ret, done;
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
len = PyUnicode_GET_LENGTH(unicode);
void *data;
Py_UCS4 x;
- if (PyUnicode_READY(mapping) < 0)
+ if (PyUnicode_READY(mapping) == -1)
return NULL;
maplen = PyUnicode_GET_LENGTH(mapping);
else if (PyUnicode_Check(x)) {
Py_ssize_t targetsize;
- if (PyUnicode_READY(x) < 0)
+ if (PyUnicode_READY(x) == -1)
goto onError;
targetsize = PyUnicode_GET_LENGTH(x);
Py_UCS4 ch;
int val;
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return -1;
size = PyUnicode_GET_LENGTH(unicode);
/* find all unencodable characters */
break;
}
/* generate replacement */
- if (PyUnicode_READY(repunicode) < 0) {
+ if (PyUnicode_READY(repunicode) == -1) {
Py_DECREF(repunicode);
return -1;
}
* 3=ignore, 4=xmlcharrefreplace */
int known_errorHandler = -1;
- if (PyUnicode_READY(unicode) < 0)
+ if (PyUnicode_READY(unicode) == -1)
return NULL;
size = PyUnicode_GET_LENGTH(unicode);
if (unicode == NULL)
return -1;
- if (PyUnicode_READY(unicode) < 0) {
+ if (PyUnicode_READY(unicode) == -1) {
Py_DECREF(unicode);
return -1;
}
if (!PyArg_ParseTuple(args, "n|O&:center", &width, convert_uc, &fillchar))
return NULL;
- if (PyUnicode_READY(self) < 0)
+ if (PyUnicode_READY(self) == -1)
return NULL;
if (PyUnicode_GET_LENGTH(self) >= width)
goto error;
}
- if (PyUnicode_READY(left))
+ if (PyUnicode_READY(left) == -1)
goto error;
- if (PyUnicode_READY(right))
+ if (PyUnicode_READY(right) == -1)
goto error;
/* Shortcuts */
if (!PyArg_ParseTuple(args, "n|O&:ljust", &width, convert_uc, &fillchar))
return NULL;
- if (PyUnicode_READY(self) < 0)
+ if (PyUnicode_READY(self) == -1)
return NULL;
if (PyUnicode_GET_LENGTH(self) >= width)
if (len == 1)
return unicode_result_unchanged(str);
- if (PyUnicode_READY(str) < 0)
+ if (PyUnicode_READY(str) == -1)
return NULL;
if (PyUnicode_GET_LENGTH(str) > PY_SSIZE_T_MAX / len) {
if (!PyArg_ParseTuple(args, "n|O&:rjust", &width, convert_uc, &fillchar))
return NULL;
- if (PyUnicode_READY(self) < 0)
+ if (PyUnicode_READY(self) == -1)
return NULL;
if (PyUnicode_GET_LENGTH(self) >= width)
if (!PyArg_ParseTuple(args, "n:zfill", &width))
return NULL;
- if (PyUnicode_READY(self) < 0)
+ if (PyUnicode_READY(self) == -1)
return NULL;
if (PyUnicode_GET_LENGTH(self) >= width)
if (unicode == NULL)
return NULL;
assert(_PyUnicode_CHECK(unicode));
- if (PyUnicode_READY(unicode)) {
+ if (PyUnicode_READY(unicode) == -1) {
Py_DECREF(unicode);
return NULL;
}