mirror of https://github.com/python/cpython
Bug #1511381: codec_getstreamcodec() in codec.c is corrected to
omit a default "error" argument for NULL pointer. This allows the parser to take a codec from cjkcodecs again. (Reported by Taewook Kang and reviewed by Walter Doerwald)
This commit is contained in:
parent
48a49f0c3b
commit
e6a1cb9700
|
@ -12,6 +12,9 @@ What's New in Python 2.5 beta 2?
|
||||||
Core and builtins
|
Core and builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Bug #1511381: codec_getstreamcodec() in codec.c is corrected to
|
||||||
|
omit a default "error" argument for NULL pointer. This allows
|
||||||
|
the parser to take a codec from cjkcodecs again.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -249,14 +249,17 @@ PyObject *codec_getstreamcodec(const char *encoding,
|
||||||
const char *errors,
|
const char *errors,
|
||||||
const int index)
|
const int index)
|
||||||
{
|
{
|
||||||
PyObject *codecs, *streamcodec;
|
PyObject *codecs, *streamcodec, *codeccls;
|
||||||
|
|
||||||
codecs = _PyCodec_Lookup(encoding);
|
codecs = _PyCodec_Lookup(encoding);
|
||||||
if (codecs == NULL)
|
if (codecs == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
streamcodec = PyEval_CallFunction(
|
codeccls = PyTuple_GET_ITEM(codecs, index);
|
||||||
PyTuple_GET_ITEM(codecs, index), "Os", stream, errors);
|
if (errors != NULL)
|
||||||
|
streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
|
||||||
|
else
|
||||||
|
streamcodec = PyObject_CallFunction(codeccls, "O", stream);
|
||||||
Py_DECREF(codecs);
|
Py_DECREF(codecs);
|
||||||
return streamcodec;
|
return streamcodec;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue