summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2006-06-23 21:16:18 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2006-06-23 21:16:18 (GMT)
commite6a1cb97000a566338fd484cbb0e7aa2e95185d8 (patch)
tree2da2f4daca488cb1ac5f3b605ec267609601bfd6 /Python
parent48a49f0c3bd61e926129be85369529f50c10afca (diff)
downloadcpython-e6a1cb97000a566338fd484cbb0e7aa2e95185d8.zip
cpython-e6a1cb97000a566338fd484cbb0e7aa2e95185d8.tar.gz
cpython-e6a1cb97000a566338fd484cbb0e7aa2e95185d8.tar.bz2
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)
Diffstat (limited to 'Python')
-rw-r--r--Python/codecs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 046abe3..4b0f4cb 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -249,14 +249,17 @@ PyObject *codec_getstreamcodec(const char *encoding,
const char *errors,
const int index)
{
- PyObject *codecs, *streamcodec;
+ PyObject *codecs, *streamcodec, *codeccls;
codecs = _PyCodec_Lookup(encoding);
if (codecs == NULL)
return NULL;
- streamcodec = PyEval_CallFunction(
- PyTuple_GET_ITEM(codecs, index), "Os", stream, errors);
+ codeccls = PyTuple_GET_ITEM(codecs, index);
+ if (errors != NULL)
+ streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
+ else
+ streamcodec = PyObject_CallFunction(codeccls, "O", stream);
Py_DECREF(codecs);
return streamcodec;
}