summaryrefslogtreecommitdiff
path: root/python/configuration.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-08 17:17:48 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-08 17:17:48 +0200
commit1040f7f6ec9cf689d6530827348a63daad52b3ef (patch)
treee043184e4e1ee74126059881a03b38a3a845f611 /python/configuration.cc
parent857774704739c39a68a1e72914a82e001e62ec93 (diff)
downloadpython-apt-1040f7f6ec9cf689d6530827348a63daad52b3ef.tar.gz
python/generic.h,tag.cc,configuration.cc: Use tp_alloc/tp_free instead of PyObject_NEW/DEL
This allows us to finally implement subclassing. Previously deletion of an instance of a subclass caused segmentation faults, this is not the case anymore.
Diffstat (limited to 'python/configuration.cc')
-rw-r--r--python/configuration.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/configuration.cc b/python/configuration.cc
index 81dd78ac..3c6ea88c 100644
--- a/python/configuration.cc
+++ b/python/configuration.cc
@@ -161,7 +161,8 @@ static PyObject *CnfSubTree(PyObject *Self,PyObject *Args)
}
// Create a new sub configuration.
- SubConfiguration *New = PyObject_NEW(SubConfiguration,&ConfigurationSubType);
+ SubConfiguration *New = (SubConfiguration*)(&ConfigurationSubType)
+ ->tp_alloc(&ConfigurationSubType,0);
new (&New->Object) Configuration(Itm);
New->Owner = Self;
Py_INCREF(Self);