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/apt_pkgmodule.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'python/apt_pkgmodule.cc') diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 085d12f4..95b72de4 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -547,6 +547,7 @@ extern "C" void initapt_pkg() // Finalize our types to add slots, etc. if (PyType_Ready(&ConfigurationPtrType) == -1) INIT_ERROR; if (PyType_Ready(&ConfigurationSubType) == -1) INIT_ERROR; + if (PyType_Ready(&PkgCacheFileType) == -1) INIT_ERROR; // Initialize the module #if PY_MAJOR_VERSION >= 3 @@ -577,8 +578,8 @@ extern "C" void initapt_pkg() ADDTYPE(Module,"Dependency",&DependencyType); // NO __new__() ADDTYPE(Module,"Description",&DescriptionType); // NO __new__() ADDTYPE(Module,"PackageFile",&PackageFileType); // NO __new__() - //ADDTYPE(Module,"PackageList",&PkgListType); // NO __new__(), internal - //ADDTYPE(Module,"DependencyList",&RDepListType); // NO __new__(), internal + ADDTYPE(Module,"PackageList",&PkgListType); // NO __new__(), internal + ADDTYPE(Module,"DependencyList",&RDepListType); // NO __new__(), internal ADDTYPE(Module,"Package",&PackageType); // NO __new__() ADDTYPE(Module,"Version",&VersionType); // NO __new__() /* ============================ cdrom.cc ============================ */ -- cgit v1.2.3