summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-24 22:30:48 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-24 22:30:48 +0000
commit7c026742048b7b148457f5dcd858b618bf1cad15 (patch)
tree6eeaf6aa8af74e3af2df1bfbc17f0dbbbae89220
parent433f8f082c888376aa6496959f329c2439fb9221 (diff)
downloadportage-7c026742048b7b148457f5dcd858b618bf1cad15.tar.gz
portage-7c026742048b7b148457f5dcd858b618bf1cad15.tar.bz2
portage-7c026742048b7b148457f5dcd858b618bf1cad15.zip
Use weakref.WeakValueDictionary to make cached Atom instances eligible for
garbage collection when no strong references remain. svn path=/main/trunk/; revision=10772
-rw-r--r--pym/portage/dep.py3
1 files changed, 2 insertions, 1 deletions
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__",