summaryrefslogtreecommitdiff
path: root/python/pkgrecords.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-21 19:47:31 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-21 19:47:31 +0200
commit13423bbbafc823740126e90ef0d7ca6e76fc7341 (patch)
tree98f59b5559b6ad2f752ad46645e1284c3549fa02 /python/pkgrecords.cc
parent894a226f24150cc35f933b72bf14c9587e15b73e (diff)
downloadpython-apt-13423bbbafc823740126e90ef0d7ca6e76fc7341.tar.gz
python: Make all CppOwnedPyObjects and similar support garbage collection.
If you want to subclass apt_pkg.Cache() and create an apt_pkg.DepCache() object in it (e.g. as self.depcache) this is needed because otherwise, Python would not know about the cyclic dependency and refuse to free any of them. This also changes apt_pkg.Cache to the standard deallocation schema, because the underlying CacheFile deletes its pointers automatically on deletion. Thus a second call is not needed.
Diffstat (limited to 'python/pkgrecords.cc')
-rw-r--r--python/pkgrecords.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc
index 1e36259d..4a3c80db 100644
--- a/python/pkgrecords.cc
+++ b/python/pkgrecords.cc
@@ -187,10 +187,11 @@ PyTypeObject PkgRecordsType =
0, // tp_setattro
0, // tp_as_buffer
(Py_TPFLAGS_DEFAULT | // tp_flags
- Py_TPFLAGS_BASETYPE),
+ Py_TPFLAGS_BASETYPE |
+ Py_TPFLAGS_HAVE_GC),
"Records Object", // tp_doc
- 0, // tp_traverse
- 0, // tp_clear
+ CppOwnedTraverse<PkgRecordsStruct>, // tp_traverse
+ CppOwnedClear<PkgRecordsStruct>, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter