[Zope3-checkins] CVS: Zope3/src/zope/interface - surrogate.py:1.1.2.7

Jim Fulton cvs-admin at zope.org
Mon Nov 10 06:24:46 EST 2003


Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv7659

Modified Files:
      Tag: adaptergeddon-branch
	surrogate.py 
Log Message:
Changed the management of wekrefs in the surrogate registry to get
around what I suspect to be a Python bug of some sort.


=== Zope3/src/zope/interface/surrogate.py 1.1.2.6 => 1.1.2.7 ===
--- Zope3/src/zope/interface/surrogate.py:1.1.2.6	Sun Nov  9 11:08:33 2003
+++ Zope3/src/zope/interface/surrogate.py	Mon Nov 10 06:24:45 2003
@@ -75,6 +75,12 @@
 
 Default = InterfaceClass("Default", (), {})
 
+
+from _zope_interface_coptimizations import debug
+
+
+
+
 class Surrogate(object):
     """Specification surrogate
 
@@ -199,7 +205,7 @@
     # weakref.ref(spec) to get weak refs to specs.
 
     def __init__(self):
-        self._surrogates = {}
+        self._surrogates = surrogates = {}
         self._default = Surrogate(Default, self)
 
         def _remove(k, selfref=weakref.ref(self)):
@@ -209,6 +215,16 @@
                     del self._surrogates[k]
                 except KeyError:
                     pass
+
+
+        def _remove(k, surrogates=surrogates):
+            try:
+                del surrogates[k]
+            except KeyError:
+                pass
+
+
+
         self._remove = _remove
 
 
@@ -685,3 +701,5 @@
                             continue
 
                     yield (ancestor, target, with, aname, factories)
+
+




More information about the Zope3-Checkins mailing list