public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10772 - main/trunk/pym/portage
@ 2008-06-24 22:30 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-06-24 22:30 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-06-24 22:30:48 +0000 (Tue, 24 Jun 2008)
New Revision: 10772

Modified:
   main/trunk/pym/portage/dep.py
Log:
Use weakref.WeakValueDictionary to make cached Atom instances eligible for
garbage collection when no strong references remain.


Modified: main/trunk/pym/portage/dep.py
===================================================================
--- main/trunk/pym/portage/dep.py	2008-06-24 21:14:45 UTC (rev 10771)
+++ main/trunk/pym/portage/dep.py	2008-06-24 22:30:48 UTC (rev 10772)
@@ -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 @@
 	"""
 
 	__metaclass__ = _AtomCache
-	_atoms = {}
+	_atoms = weakref.WeakValueDictionary()
 
 	_str_methods = ("endswith", "find", "index", "lstrip", "replace",
 		"startswith", "strip", "rindex", "rfind", "rstrip", "__getitem__",

-- 
gentoo-commits@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-24 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 22:30 [gentoo-commits] portage r10772 - main/trunk/pym/portage Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox