Lines Matching defs:encoding

143     {"encoding", (getter)textiobase_encoding_get, NULL, textiobase_encoding_doc},
638 PyObject *encoding;
653 /* Specialized encoding func (see below) */
662 buffered. This is necessary so that encoding errors are immediately
694 encoding methods for the most popular encodings. */
772 // Return true when encoding can be skipped when text is ascii.
781 /* Map normalized encoding names onto the specialized encoding funcs */
1001 if (!interp->unicode.fs_codec.encoding) {
1027 encoding: str(accept={str, NoneType}) = None
1035 encoding gives the name of the encoding that the stream will be
1038 errors determines the strictness of encoding and decoding (see
1065 const char *encoding, PyObject *errors,
1077 if (encoding == NULL) {
1081 "'encoding' argument not specified", 1)) {
1108 Py_CLEAR(self->encoding);
1122 if (encoding == NULL && _PyRuntime.preconfig.utf8_mode) {
1124 self->encoding = Py_NewRef(&_Py_STR(utf_8));
1126 else if (encoding == NULL || (strcmp(encoding, "locale") == 0)) {
1127 self->encoding = _Py_GetLocaleEncodingObject();
1128 if (self->encoding == NULL) {
1131 assert(PyUnicode_Check(self->encoding));
1134 if (self->encoding != NULL) {
1135 encoding = PyUnicode_AsUTF8(self->encoding);
1136 if (encoding == NULL)
1139 else if (encoding != NULL) {
1140 self->encoding = PyUnicode_FromString(encoding);
1141 if (self->encoding == NULL)
1146 "could not determine default encoding");
1150 /* Check we have been asked for a real text encoding */
1151 codec_info = _PyCodec_LookupTextEncoding(encoding, "codecs.open()");
1153 Py_CLEAR(self->encoding);
1158 * of the partially constructed object (like self->encoding)
1247 textiowrapper_change_encoding(textio *self, PyObject *encoding,
1251 if (encoding == Py_None && errors == Py_None && !newline_changed) {
1255 if (encoding == Py_None) {
1256 encoding = self->encoding;
1260 Py_INCREF(encoding);
1263 if (_PyUnicode_EqualToASCIIString(encoding, "locale")) {
1264 encoding = _Py_GetLocaleEncodingObject();
1265 if (encoding == NULL) {
1269 Py_INCREF(encoding);
1278 Py_DECREF(encoding);
1284 PyUnicode_AsUTF8(encoding), "codecs.open()");
1286 Py_DECREF(encoding);
1292 Py_DECREF(encoding);
1298 Py_SETREF(self->encoding, encoding);
1307 encoding: object = None
1320 _io_TextIOWrapper_reconfigure_impl(textio *self, PyObject *encoding,
1332 if (encoding != Py_None || errors != Py_None || newline_obj != NULL) {
1333 _unsupported("It is not possible to set the encoding or newline "
1366 self, encoding, errors, newline_obj != NULL) < 0) {
1380 Py_CLEAR(self->encoding);
1412 Py_VISIT(self->encoding);
2916 s = PyUnicode_FromFormat("%U encoding=%R>",
2917 res, self->encoding);
3239 {"encoding", T_OBJECT, offsetof(textio, encoding), READONLY},