changeset 9133:996c1cd8f530

store: eliminate reference cycle in fncachestore no reference to self in fncacheopener Inspired by Adrian Buehlmann
author Simon Heimberg <simohe@besonet.ch>
date Tue, 14 Jul 2009 14:05:07 +0200
parents b47d7b440c5c
children 47ce7a3a1fb0 fe160ba4c976
files mercurial/store.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Fri Jul 10 19:34:08 2009 +0900
+++ b/mercurial/store.py	Tue Jul 14 14:05:07 2009 +0200
@@ -284,16 +284,17 @@
         self.pathjoiner = pathjoiner
         self.path = self.pathjoiner(path, 'store')
         self.createmode = _calcmode(self.path)
-        self._op = opener(self.path)
-        self._op.createmode = self.createmode
-        self.fncache = fncache(self._op)
+        op = opener(self.path)
+        op.createmode = self.createmode
+        fnc = fncache(op)
+        self.fncache = fnc
 
         def fncacheopener(path, mode='r', *args, **kw):
             if (mode not in ('r', 'rb')
                 and path.startswith('data/')
-                and path not in self.fncache):
-                    self.fncache.add(path)
-            return self._op(hybridencode(path), mode, *args, **kw)
+                and path not in fnc):
+                    fnc.add(path)
+            return op(hybridencode(path), mode, *args, **kw)
         self.opener = fncacheopener
 
     def join(self, f):