Lines Matching defs:errors

25 "I.encode(unicode[, errors]) -> (string, length consumed)\n\

27 Return an encoded string version of `unicode'. errors may be given to\n\
29 encoding errors raise a UnicodeEncodeError. Other possible values are\n\
34 "I.decode(string[, errors]) -> (unicodeobject, length consumed)\n\
36 Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\
38 that encoding errors raise a UnicodeDecodeError. Other possible values\n\
42 static char *codeckwarglist[] = {"input", "errors", NULL};
43 static char *incnewkwarglist[] = {"errors", NULL};
45 static char *streamkwarglist[] = {"stream", "errors", NULL};
79 internal_error_callback(const char *errors)
81 if (errors == NULL || strcmp(errors, "strict") == 0)
83 else if (strcmp(errors, "ignore") == 0)
85 else if (strcmp(errors, "replace") == 0)
88 return PyString_FromString(errors);
92 call_error_callback(PyObject *errors, PyObject *exc)
96 assert(PyString_Check(errors));
97 cb = PyCodec_LookupError(PyString_AS_STRING(errors));
119 const char *errors;
121 if (self->errors == ERROR_STRICT)
122 errors = "strict";
123 else if (self->errors == ERROR_IGNORE)
124 errors = "ignore";
125 else if (self->errors == ERROR_REPLACE)
126 errors = "replace";
128 Py_INCREF(self->errors);
129 return self->errors;
132 return PyString_FromString(errors);
142 PyErr_SetString(PyExc_TypeError, "errors must be a string");
150 ERROR_DECREF(self->errors);
151 self->errors = cb;
157 {"errors", (getter)codecctx_errors_get,
159 PyDoc_STR("how to treat errors")},
223 PyObject *errors, Py_ssize_t e)
254 if (errors == ERROR_REPLACE) {
277 if (errors == ERROR_IGNORE || errors == ERROR_REPLACE) {
300 if (errors == ERROR_STRICT) {
305 retobj = call_error_callback(errors, buf->excobj);
361 PyObject *errors, Py_ssize_t e)
392 if (errors == ERROR_REPLACE) {
396 if (errors == ERROR_IGNORE || errors == ERROR_REPLACE) {
419 if (errors == ERROR_STRICT) {
424 retobj = call_error_callback(errors, buf->excobj);
469 PyObject *errors, int flags)
503 else if (multibytecodec_encerror(codec, state, &buf, errors,r))
519 &buf, errors, r))
547 const char *errors = NULL;
551 codeckwarglist, &arg, &errors))
571 errorcb = internal_error_callback(errors);
604 const char *data, *errors = NULL;
608 codeckwarglist, &pdata, &errors))
613 errorcb = internal_error_callback(errors);
780 ctx->errors, final ? MBENC_FLUSH | MBENC_RESET : 0);
867 buf, ctx->errors, r))
916 char *errors = NULL;
919 incnewkwarglist, &errors))
936 self->errors = internal_error_callback(errors);
937 if (self->errors == NULL)
962 if (ERROR_ISCUSTOM(self->errors))
963 Py_VISIT(self->errors);
971 ERROR_DECREF(self->errors);
1068 &buf, self->errors, MBERR_TOOFEW)) {
1125 char *errors = NULL;
1128 incnewkwarglist, &errors))
1145 self->errors = internal_error_callback(errors);
1146 if (self->errors == NULL)
1171 if (ERROR_ISCUSTOM(self->errors))
1172 Py_VISIT(self->errors);
1180 ERROR_DECREF(self->errors);
1301 &buf, self->errors, MBERR_TOOFEW))
1441 char *errors = NULL;
1444 streamkwarglist, &stream, &errors))
1463 self->errors = internal_error_callback(errors);
1464 if (self->errors == NULL)
1489 if (ERROR_ISCUSTOM(self->errors))
1490 Py_VISIT(self->errors);
1499 ERROR_DECREF(self->errors);
1615 &pending, self->pendingsize, self->errors,
1643 char *errors = NULL;
1646 streamkwarglist, &stream, &errors))
1665 self->errors = internal_error_callback(errors);
1666 if (self->errors == NULL)
1691 if (ERROR_ISCUSTOM(self->errors))
1692 Py_VISIT(self->errors);
1701 ERROR_DECREF(self->errors);