name);
return -1;
}
- /* PyUnicode_READY() is called in PyUnicode_GetLength() */
*target = PyUnicode_READ_CHAR(src, 0);
}
}
name);
return -1;
}
- /* PyUnicode_READY() is called in PyUnicode_GetLength() */
*target = PyUnicode_READ_CHAR(src, 0);
}
return 0;
return -1;
}
else {
- if (PyUnicode_READY(src) == -1)
- return -1;
Py_XSETREF(*target, Py_NewRef(src));
}
}
Py_DECREF(lineobj);
return NULL;
}
- if (PyUnicode_READY(lineobj) == -1) {
- Py_DECREF(lineobj);
- return NULL;
- }
++self->line_num;
kind = PyUnicode_KIND(lineobj);
data = PyUnicode_DATA(lineobj);
Py_ssize_t rec_len;
if (field != NULL) {
- if (PyUnicode_READY(field) == -1)
- return 0;
field_kind = PyUnicode_KIND(field);
field_data = PyUnicode_DATA(field);
field_len = PyUnicode_GET_LENGTH(field);
"dialect name must be a string");
return NULL;
}
- if (PyUnicode_READY(name_obj) == -1)
- return NULL;
dialect = _call_dialect(module_state, dialect_obj, kwargs);
if (dialect == NULL)
return NULL;
}
}
else if (PyUnicode_Check(state)) {
- if (PyUnicode_READY(state)) {
- return NULL;
- }
if (PyUnicode_GET_LENGTH(state) == _PyDateTime_DATE_DATASIZE &&
MONTH_IS_SANE(PyUnicode_READ_CHAR(state, 2)))
{
}
}
else if (PyUnicode_Check(state)) {
- if (PyUnicode_READY(state)) {
- return NULL;
- }
if (PyUnicode_GET_LENGTH(state) == _PyDateTime_TIME_DATASIZE &&
(0x7F & PyUnicode_READ_CHAR(state, 0)) < 24)
{
}
}
else if (PyUnicode_Check(state)) {
- if (PyUnicode_READY(state)) {
- return NULL;
- }
if (PyUnicode_GET_LENGTH(state) == _PyDateTime_DATETIME_DATASIZE &&
MONTH_IS_SANE(PyUnicode_READ_CHAR(state, 2) & 0x7F))
{
Py_ssize_t j, len;
int d;
- if (PyUnicode_READY(u) == -1) {
- return NULL;
- }
-
kind = PyUnicode_KIND(u);
data = PyUnicode_DATA(u);
len = PyUnicode_GET_LENGTH(u);
/*[clinic end generated code: output=bff29dc5d4566c68 input=f6944c48d3f84c58]*/
{
if (PyUnicode_Check(tag)) {
- if (PyUnicode_READY(tag) < 0)
- return NULL;
if (PyUnicode_GET_LENGTH(tag) == 1 && PyUnicode_READ_CHAR(tag, 0) == '*')
tag = Py_None;
}
/* ASCII unicode string */
if(PyUnicode_Check(a) && PyUnicode_Check(b)) {
- if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
- return NULL;
- }
if (!PyUnicode_IS_ASCII(a) || !PyUnicode_IS_ASCII(b)) {
PyErr_SetString(PyExc_TypeError,
"comparing strings with non-ASCII characters is "
return -1;
assert(PyUnicode_Check(decoded));
- if (PyUnicode_READY(decoded)) {
- Py_DECREF(decoded);
- return -1;
- }
len = PyUnicode_GET_LENGTH(decoded);
assert(len >= 0);
Py_TYPE(obj)->tp_name);
return NULL;
}
- if (PyUnicode_READY(obj))
- return NULL;
CHECK_CLOSED(self);
size = PyUnicode_GET_LENGTH(obj);
Py_DECREF(decoded);
return -1;
}
- if (PyUnicode_READY(decoded) < 0) {
- Py_DECREF(decoded);
- return -1;
- }
return 0;
}
int haslf = 0;
int needflush = 0, text_needflush = 0;
- if (PyUnicode_READY(text) == -1)
- return NULL;
-
CHECK_ATTACHED(self);
CHECK_CLOSED(self);
result = textiowrapper_get_decoded_chars(self, n);
if (result == NULL)
goto fail;
- if (PyUnicode_READY(result) == -1)
- goto fail;
remaining -= PyUnicode_GET_LENGTH(result);
/* Keep reading chunks until we have n characters to return */
Py_CLEAR(remaining);
if (line == NULL)
goto error;
- if (PyUnicode_READY(line) == -1)
- goto error;
}
ptr = PyUnicode_DATA(line);
}
}
- if (line == NULL || PyUnicode_READY(line) == -1)
+ if (line == NULL)
return NULL;
if (PyUnicode_GET_LENGTH(line) == 0) {
Py_UCS1 *output;
int kind;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
input_chars = PyUnicode_GET_LENGTH(pystr);
input = PyUnicode_DATA(pystr);
kind = PyUnicode_KIND(pystr);
int kind;
Py_UCS4 maxchar;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
maxchar = PyUnicode_MAX_CHAR_VALUE(pystr);
input_chars = PyUnicode_GET_LENGTH(pystr);
input = PyUnicode_DATA(pystr);
const void *buf;
int kind;
- if (PyUnicode_READY(pystr) == -1)
- return 0;
-
_PyUnicodeWriter writer;
_PyUnicodeWriter_Init(&writer);
writer.overallocate = 1;
int has_pairs_hook = (s->object_pairs_hook != Py_None);
Py_ssize_t next_idx;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
str = PyUnicode_DATA(pystr);
kind = PyUnicode_KIND(pystr);
end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
PyObject *rval;
Py_ssize_t next_idx;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
rval = PyList_New(0);
if (rval == NULL)
return NULL;
PyObject *numstr = NULL;
PyObject *custom_func;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
str = PyUnicode_DATA(pystr);
kind = PyUnicode_KIND(pystr);
end_idx = PyUnicode_GET_LENGTH(pystr) - 1;
int kind;
Py_ssize_t length;
- if (PyUnicode_READY(pystr) == -1)
- return NULL;
-
str = PyUnicode_DATA(pystr);
kind = PyUnicode_KIND(pystr);
length = PyUnicode_GET_LENGTH(pystr);
/* ASCII unicode string */
if(PyUnicode_Check(a) && PyUnicode_Check(b)) {
- if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
- return NULL;
- }
if (!PyUnicode_IS_ASCII(a) || !PyUnicode_IS_ASCII(b)) {
PyErr_SetString(PyExc_TypeError,
"comparing strings with non-ASCII characters is "
Py_DECREF(attr);
return NULL;
}
- if (PyUnicode_READY(item)) {
- Py_DECREF(attr);
- return NULL;
- }
Py_ssize_t item_len = PyUnicode_GET_LENGTH(item);
int kind = PyUnicode_KIND(item);
const void *data = PyUnicode_DATA(item);
int kind;
_PyBytesWriter writer;
- if (PyUnicode_READY(obj))
- return NULL;
-
_PyBytesWriter_Init(&writer);
size = PyUnicode_GET_LENGTH(obj);
Py_ssize_t size;
const char *data;
- if (PyUnicode_READY(obj))
- return -1;
-
data = PyUnicode_AsUTF8AndSize(obj, &size);
if (data == NULL) {
/* Issue #8383: for strings with lone surrogates, fallback on the
/* Unicode objects do not support the buffer API. So, get the data
directly instead. */
if (PyUnicode_Check(string)) {
- if (PyUnicode_READY(string) == -1)
- return NULL;
*p_length = PyUnicode_GET_LENGTH(string);
*p_charsize = PyUnicode_KIND(string);
*p_isbytes = 0;
}
if (PyUnicode_Check(value)) {
- if (PyUnicode_READY(value) == -1)
- return NULL;
-
Py_ssize_t size = PyUnicode_GET_LENGTH(value);
if (size == 0) {
return Tcl_NewStringObj("", 0);
return 1;
}
if (PyUnicode_Check(arg)) {
- if (PyUnicode_READY(arg) < 0)
- return 0;
if (!PyUnicode_IS_ASCII(arg)) {
PyErr_SetString(PyExc_ValueError,
"string argument should contain only ASCII characters");
int kind;
const void *data;
- if (PyUnicode_READY(text) < 0)
- return NULL;
datalen = PyUnicode_GET_LENGTH(text);
if (datalen == 0 && !(flags & MBENC_RESET))
}
}
- if (PyUnicode_READY(input) < 0) {
- Py_XDECREF(ucvt);
- return NULL;
- }
datalen = PyUnicode_GET_LENGTH(input);
errorcb = internal_error_callback(errors);
inbuf = Py_NewRef(unistr);
}
- if (PyUnicode_READY(inbuf) < 0)
- goto errorexit;
inpos = 0;
datalen = PyUnicode_GET_LENGTH(inbuf);
return XML_STATUS_ERROR;
u = PyUnicode_Decode((const char*) template_buffer, 256, name, "replace");
- if (u == NULL || PyUnicode_READY(u)) {
+ if (u == NULL) {
Py_XDECREF(u);
return XML_STATUS_ERROR;
}
len = PyByteArray_Size(obj);
}
else if (PyUnicode_Check(obj)) {
- if (PyUnicode_READY(obj) == -1) {
- return 0;
- }
if (PyUnicode_IS_COMPACT_ASCII(obj)) {
data->buf = PyUnicode_DATA(obj);
len = PyUnicode_GET_LENGTH(obj);
PyObject *input)
/*[clinic end generated code: output=11e5a3694e723ca5 input=a544f14cea79e508]*/
{
- if (PyUnicode_READY(input) == -1) {
- return NULL;
- }
-
if (PyUnicode_GET_LENGTH(input) == 0) {
/* special case empty input strings. */
Py_RETURN_TRUE;
writer.use_bytearray = use_bytearray;
assert(PyUnicode_Check(string));
- if (PyUnicode_READY(string))
- return NULL;
hexlen = PyUnicode_GET_LENGTH(string);
if (!PyUnicode_IS_ASCII(string)) {
for (Py_ssize_t i = PyTuple_GET_SIZE(tuple); --i >= 0; ) {
PyObject *v = PyTuple_GET_ITEM(tuple, i);
if (PyUnicode_CheckExact(v)) {
- if (PyUnicode_READY(v) == -1) {
- return -1;
- }
-
if (all_name_chars(v)) {
PyObject *w = v;
PyUnicode_InternInPlace(&v);
PyCodeObject *
_PyCode_New(struct _PyCodeConstructor *con)
{
- /* Ensure that strings are ready Unicode string */
- if (PyUnicode_READY(con->name) < 0) {
- return NULL;
- }
- if (PyUnicode_READY(con->qualname) < 0) {
- return NULL;
- }
- if (PyUnicode_READY(con->filename) < 0) {
- return NULL;
- }
-
if (intern_strings(con->names) < 0) {
return NULL;
}
int kind;
const void *data;
- if (PyUnicode_READY(name))
- return NULL;
kind = PyUnicode_KIND(name);
data = PyUnicode_DATA(name);
size = PyUnicode_GET_LENGTH(name);
Py_DECREF(res);
return NULL;
}
-#ifndef Py_DEBUG
- if (PyUnicode_READY(res) < 0) {
- return NULL;
- }
-#endif
return res;
}
if (v == NULL)
return PyUnicode_FromString("<NULL>");
if (PyUnicode_CheckExact(v)) {
-#ifndef Py_DEBUG
- if (PyUnicode_READY(v) < 0)
- return NULL;
-#endif
return Py_NewRef(v);
}
if (Py_TYPE(v)->tp_str == NULL)
Py_DECREF(res);
return NULL;
}
-#ifndef Py_DEBUG
- if (PyUnicode_READY(res) < 0) {
- return NULL;
- }
-#endif
assert(_PyUnicode_CheckConsistency(res, 1));
return res;
}
}
else {
/* rep is unicode */
- if (PyUnicode_READY(rep) < 0)
- goto error;
-
if (!PyUnicode_IS_ASCII(rep)) {
raise_encode_exception(&exc, "utf-8", unicode,
startpos, endpos,
if (conversion != '\0') {
tmp = do_conversion(fieldobj, conversion);
- if (tmp == NULL || PyUnicode_READY(tmp) == -1)
+ if (tmp == NULL)
goto done;
/* do the assignment, transferring ownership: fieldobj = tmp */
if (format_spec_needs_expanding) {
tmp = build_string(format_spec, args, kwargs, recursion_depth-1,
auto_number);
- if (tmp == NULL || PyUnicode_READY(tmp) == -1)
+ if (tmp == NULL)
goto done;
/* note that in the case we're expanding the format string,
int recursion_depth = 2;
AutoNumber auto_number;
-
- if (PyUnicode_READY(self) == -1)
- return NULL;
-
AutoNumber_Init(&auto_number);
SubString_init(&input, self, 0, PyUnicode_GET_LENGTH(self));
return build_string(&input, args, kwargs, recursion_depth, &auto_number);
return NULL;
}
- if (PyUnicode_READY(self) == -1)
- return NULL;
-
it = PyObject_New(formatteriterobject, &PyFormatterIter_Type);
if (it == NULL)
return NULL;
return NULL;
}
- if (PyUnicode_READY(self) == -1)
- return NULL;
-
it = PyObject_New(fieldnameiterobject, &PyFieldNameIter_Type);
if (it == NULL)
return NULL;
}
if (PyUnicode_Check(name)) {
if (PyUnicode_CheckExact(name)) {
- if (PyUnicode_READY(name) == -1)
- return -1;
Py_INCREF(name);
}
else {
PyObject *first_identifier = first_name->v.Name.id;
PyObject *second_identifier = second_name->v.Name.id;
- if (PyUnicode_READY(first_identifier) == -1) {
- return NULL;
- }
- if (PyUnicode_READY(second_identifier) == -1) {
- return NULL;
- }
const char *first_str = PyUnicode_AsUTF8(first_identifier);
if (!first_str) {
return NULL;
Py_UCS4 ch;
PyObject *truncated;
- if (PyUnicode_READY(sourceline) < 1)
- goto error;
-
kind = PyUnicode_KIND(sourceline);
data = PyUnicode_DATA(sourceline);
len = PyUnicode_GET_LENGTH(sourceline);
}
}
else if (PyUnicode_Check(c)) {
- if (PyUnicode_READY(c) == -1)
- return NULL;
size = PyUnicode_GET_LENGTH(c);
if (size == 1) {
ord = (long)PyUnicode_READ_CHAR(c, 0);
/* Do the hard part, converting to a string in a given base */
tmp = _PyLong_Format(value, base);
- if (tmp == NULL || PyUnicode_READY(tmp) == -1)
+ if (tmp == NULL)
goto done;
inumeric_chars = 0;
if (!PyUnicode_Check(arg))
return converterr("a unicode character", arg, msgbuf, bufsize);
- if (PyUnicode_READY(arg))
- RETURN_ERR_OCCURRED;
-
if (PyUnicode_GET_LENGTH(arg) != 1)
return converterr("a unicode character", arg, msgbuf, bufsize);
case 'U': { /* PyUnicode object */
PyObject **p = va_arg(*p_va, PyObject **);
if (PyUnicode_Check(arg)) {
- if (PyUnicode_READY(arg) == -1)
- RETURN_ERR_OCCURRED;
*p = arg;
}
else
if (!haspath) {
Py_ssize_t dot;
- if (PyUnicode_READY(package) < 0) {
- goto error;
- }
-
dot = PyUnicode_FindChar(package, '.',
0, PyUnicode_GET_LENGTH(package), -1);
if (dot == -2) {
"module name must be a string");
goto error;
}
- if (PyUnicode_READY(name) < 0) {
- goto error;
- }
if (level < 0) {
_PyErr_SetString(tstate, PyExc_ValueError, "level must be >= 0");
goto error;
break;
}
if (skip_leading_underscores) {
- if (PyUnicode_READY(name) == -1) {
- Py_DECREF(name);
- err = -1;
- break;
- }
if (PyUnicode_READ_CHAR(name, 0) == '_') {
Py_DECREF(name);
continue;
return NULL;
}
if (PyUnicode_Check(sep)) {
- if (PyUnicode_READY(sep))
- return NULL;
if (PyUnicode_KIND(sep) != PyUnicode_1BYTE_KIND) {
PyErr_SetString(PyExc_ValueError, "sep must be ASCII.");
return NULL;