mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Build with --disable-unicode again. Fixes #1158607.
Will backport to 2.4.
This commit is contained in:
parent
b60ae99601
commit
e2713becd8
7 changed files with 41 additions and 14 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue