]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF Patch #1297028, cjkcodecs does not initialize type pointer
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 21 Sep 2005 06:44:25 +0000 (06:44 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 21 Sep 2005 06:44:25 +0000 (06:44 +0000)
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.

Misc/NEWS
Modules/cjkcodecs/multibytecodec.c

index 293ba2fc1a52c5a9af58f7ba3302027d4d786454..9144f5ddf17331caa104e4164263f1ceb593b4b4 100644 (file)
--- 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.
index 4444941bde5faf09a6e9027c673240ddff1bece8..7d2d15ebfb78e04e8be8d1f0ad0bfcf9e3e99216 100644 (file)
@@ -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())