From: Neal Norwitz Date: Wed, 21 Sep 2005 06:44:25 +0000 (+0000) Subject: SF Patch #1297028, cjkcodecs does not initialize type pointer X-Git-Tag: v2.5a0~1347 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=058bde194485ff4a0860c1dfc152763403655303;p=thirdparty%2FPython%2Fcpython.git SF Patch #1297028, cjkcodecs does not initialize type pointer Fix segfault. I tried to write a test, but it wouldn't crash when running regrtest. This really should have some sort of test. Should definitely be backported. --- diff --git a/Misc/NEWS b/Misc/NEWS index 293ba2fc1a52..9144f5ddf173 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -149,6 +149,9 @@ present). Extension Modules ----------------- +- Patch #1297028: fix segfault if call type on MultibyteCodec, + MultibyteStreamReader, or MultibyteStreamWriter + - Fix memory leak in posix.access(). - Patch #1213831: Fix typo in unicodedata._getcode. diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c index 4444941bde5f..7d2d15ebfb78 100644 --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -1265,6 +1265,10 @@ static struct PyMethodDef __methods[] = { void init_multibytecodec(void) { + MultibyteCodec_Type.ob_type = &PyType_Type; + MultibyteStreamReader_Type.ob_type = &PyType_Type; + MultibyteStreamWriter_Type.ob_type = &PyType_Type; + Py_InitModule("_multibytecodec", __methods); if (PyErr_Occurred())