Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/dispatch/saferef.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/dispatch/saferef.py')
-rw-r--r--src/sugar/dispatch/saferef.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sugar/dispatch/saferef.py b/src/sugar/dispatch/saferef.py
index 7c9e1db..b0ceef9 100644
--- a/src/sugar/dispatch/saferef.py
+++ b/src/sugar/dispatch/saferef.py
@@ -7,6 +7,7 @@ aren't handled by the core weakref module).
import weakref, traceback
+
def safeRef(target, onDelete = None):
"""Return a *safe* weak reference to a callable target
@@ -33,6 +34,7 @@ def safeRef(target, onDelete = None):
else:
return weakref.ref( target )
+
class BoundMethodWeakref(object):
"""'Safe' and reusable weak references to instance methods
@@ -179,6 +181,7 @@ class BoundMethodWeakref(object):
return function.__get__(target)
return None
+
class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
"""A specialized BoundMethodWeakref, for platforms where instance methods
are not descriptors.
@@ -239,6 +242,7 @@ class BoundNonDescriptorMethodWeakref(BoundMethodWeakref):
return getattr(target, function.__name__)
return None
+
def get_bound_method_weakref(target, onDelete):
"""Instantiates the appropiate BoundMethodWeakRef, depending on the details of
the underlying class method implementation"""