Skip to content

apt_pkg: add support for weakrefs to Cache objects

Simon Chopin requested to merge schopin/python-apt:weakrefs into main

Cache objects (along with their "children") can be rather big, and for applications doing heavy computations on potentially multiple apt caches, e.g. ubuntu-drivers, weakrefs are a rather interesting feature.

See https://github.com/canonical/ubuntu-drivers-common/pull/116 for an instance where such a weakref would have been helpful.

On the performance side, I don't expect much impact on non-Cache objects since we were already loading the tp_flags variable anyway and any halfway-decent branch predictor should presumably favor the non-weakref scenario.

Merge request reports

Loading