#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString(
- PyObject *unicode,
- const char *errors);
+ PyObject *unicode);
#endif
/* Returns a pointer to the default encoding (UTF-8) of the
return NULL;
}
if (PyUnicode_Check(proto)) {
- PyObject *v = _PyUnicode_AsDefaultEncodedString(proto, NULL);
+ PyObject *v = _PyUnicode_AsDefaultEncodedString(proto);
if (!v)
goto error;
proto_str = PyBytes_AS_STRING(v);
return -1;
}
if (PyUnicode_Check(arg)) {
- arg = _PyUnicode_AsDefaultEncodedString(arg, NULL);
+ arg = _PyUnicode_AsDefaultEncodedString(arg);
if (arg == NULL)
return -1;
}
res = slot_tp_repr(self);
if (!res)
return NULL;
- ress = _PyUnicode_AsDefaultEncodedString(res, NULL);
+ ress = _PyUnicode_AsDefaultEncodedString(res);
Py_DECREF(res);
return ress;
}
}
PyObject *
-_PyUnicode_AsDefaultEncodedString(PyObject *unicode,
- const char *errors)
+_PyUnicode_AsDefaultEncodedString(PyObject *unicode)
{
PyObject *v = ((PyUnicodeObject *)unicode)->defenc;
if (v)
return v;
- if (errors != NULL)
- Py_FatalError("non-NULL encoding in _PyUnicode_AsDefaultEncodedString");
v = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
PyUnicode_GET_SIZE(unicode),
NULL);
PyErr_BadArgument();
return NULL;
}
- bytes = _PyUnicode_AsDefaultEncodedString(unicode, NULL);
+ bytes = _PyUnicode_AsDefaultEncodedString(unicode);
if (bytes == NULL)
return NULL;
if (psize != NULL)
if (PyUnicode_Check(cmd)) {
cf->cf_flags |= PyCF_IGNORE_COOKIE;
- cmd = _PyUnicode_AsDefaultEncodedString(cmd, NULL);
+ cmd = _PyUnicode_AsDefaultEncodedString(cmd);
if (cmd == NULL)
return NULL;
}
case Name_kind:
/* optimize away names that can't be reassigned */
id = PyBytes_AS_STRING(
- _PyUnicode_AsDefaultEncodedString(e->v.Name.id, NULL));
+ _PyUnicode_AsDefaultEncodedString(e->v.Name.id));
if (strcmp(id, "True") == 0) return 1;
if (strcmp(id, "False") == 0) return 0;
if (strcmp(id, "None") == 0) return 0;
#define UNICODE_DEFAULT_ENCODING(arg) \
- _PyUnicode_AsDefaultEncodedString(arg, NULL)
+ _PyUnicode_AsDefaultEncodedString(arg)
/* Format an error message generated by convertsimple(). */