Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 38923:6f042f5bf94d legacy-trunk
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)
| author | Hye-Shik Chang <hyeshik@gmail.com> |
|---|---|
| date | Fri, 23 Jun 2006 21:16:18 +0000 |
| parents | 19ad3d35fac4 |
| children | 4fe192d48960 |
line wrap: on
line diff
--- a/Python/codecs.c Fri Jun 23 19:23:40 2006 +0000 +++ b/Python/codecs.c Fri Jun 23 21:16:18 2006 +0000 @@ -249,14 +249,17 @@ 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; }
