From 7c026742048b7b148457f5dcd858b618bf1cad15 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 24 Jun 2008 22:30:48 +0000 Subject: Use weakref.WeakValueDictionary to make cached Atom instances eligible for garbage collection when no strong references remain. svn path=/main/trunk/; revision=10772 --- pym/portage/dep.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 3d3b5d954..41d6b128b 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -19,6 +19,7 @@ # import re, sys, types +import weakref from itertools import chain import portage.exception from portage.exception import InvalidData, InvalidAtom @@ -412,7 +413,7 @@ class Atom(object): """ __metaclass__ = _AtomCache - _atoms = {} + _atoms = weakref.WeakValueDictionary() _str_methods = ("endswith", "find", "index", "lstrip", "replace", "startswith", "strip", "rindex", "rfind", "rstrip", "__getitem__", -- cgit v1.2.3-1-g7c22