Build with --disable-unicode again. Fixes #1158607.

Will backport to 2.4.
This commit is contained in:
Martin v. Löwis 2005-03-08 15:03:08 +00:00
parent b60ae99601
commit e2713becd8
7 changed files with 41 additions and 14 deletions

View file

@ -104,8 +104,15 @@ codec_encode(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O|ss:encode", &v, &encoding, &errors))
return NULL;
#ifdef Py_USING_UNICODE
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
#else
if (encoding == NULL) {
PyErr_SetString(PyExc_ValueError, "no encoding specified");
return NULL;
}
#endif
/* Encode via the codec registry */
v = PyCodec_Encode(v, encoding, errors);
@ -137,8 +144,15 @@ codec_decode(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O|ss:decode", &v, &encoding, &errors))
return NULL;
#ifdef Py_USING_UNICODE
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
#else
if (encoding == NULL) {
PyErr_SetString(PyExc_ValueError, "no encoding specified");
return NULL;
}
#endif
/* Decode via the codec registry */
v = PyCodec_Decode(v, encoding, errors);