From fc874b8b9507401a232d42fa7936148f76b0a1e2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Jun 2009 17:29:57 +0200 Subject: python/cache.cc: Fix segfaults using the new allocation methods. We switched to using tp_alloc() to create new objects. Some types had no tp_flags set and were not initialized using PyType_Ready, causing tp_alloc (PyType_GenericAlloc) to crash. --- python/cache.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'python/cache.cc') diff --git a/python/cache.cc b/python/cache.cc index 38b715de..c988145f 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -374,6 +374,12 @@ PyTypeObject PkgCacheFileType = 0, // tp_as_sequence 0, // tp_as_mapping 0, // tp_hash + 0, // tp_call + 0, // tp_str + 0, // tp_getattro + 0, // tp_setattro + 0, // tp_as_buffer + Py_TPFLAGS_DEFAULT, // tp_flags }; /*}}}*/ // Package List Class /*{{{*/ @@ -444,6 +450,12 @@ PyTypeObject PkgListType = &PkgListSeq, // tp_as_sequence 0, // tp_as_mapping 0, // tp_hash + 0, // tp_call + 0, // tp_str + 0, // tp_getattro + 0, // tp_setattro + 0, // tp_as_buffer + Py_TPFLAGS_DEFAULT , // tp_flags }; #define MkGet(PyFunc,Ret) static PyObject *PyFunc(PyObject *Self,void*) \ @@ -656,7 +668,7 @@ PyTypeObject DescriptionType = 0, // tp_setattro 0, // tp_as_buffer Py_TPFLAGS_DEFAULT, // tp_flags - "AcquireItem Object", // tp_doc + "apt_pkg.Description Object", // tp_doc 0, // tp_traverse 0, // tp_clear 0, // tp_richcompare @@ -1340,6 +1352,12 @@ PyTypeObject RDepListType = &RDepListSeq, // tp_as_sequence 0, // tp_as_mapping 0, // tp_hash + 0, // tp_call + 0, // tp_str + 0, // tp_getattro + 0, // tp_setattro + 0, // tp_as_buffer + Py_TPFLAGS_DEFAULT, // tp_flags }; /*}}}*/ -- cgit v1.2.3