store: eliminate reference cycle in fncachestore
authorSimon Heimberg <simohe@besonet.ch>
Tue, 14 Jul 2009 14:05:07 +0200
changeset 9133 996c1cd8f530
parent 9132 b47d7b440c5c
child 9154 47ce7a3a1fb0
child 9173 fe160ba4c976
store: eliminate reference cycle in fncachestore no reference to self in fncacheopener Inspired by Adrian Buehlmann
mercurial/store.py
--- 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):