Changeset 142
- Timestamp:
- 05/06/02 18:13:12 (6 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/WeakBind.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/WeakBind.py
r139 r142 56 56 57 57 class BoundCallable(BoundCallableBase): 58 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 59 #~ Constants / Variables / Etc. 60 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 61 58 62 im_self = None 59 63 im_func = None 60 64 65 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 66 #~ Special 67 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 61 69 def __init__(self, callback): 62 if callback is None: 63 self.im_func = None 70 if callback is None: 71 # A "None" method... it should expire immediately 72 pass 73 elif isinstance(callback, BoundCallableBase): 74 # One of those weird instances where we are proxying for an object very similar to ourself... 75 # keep a hard reference to the BoundCallableBase 76 self.im_func = callback 64 77 elif isinstance(callback, typesMethods): 78 # Wrap up the method and potential instance 65 79 if callback.im_self is not None: 66 80 self.im_self = weakref.ref(callback.im_self) 67 81 self.im_func = callback.im_func 68 82 elif isinstance(callback, typesInstances): 83 # This is a "callable object", make a weakref to it 69 84 self.im_self = weakref.ref(callback) 70 85 self.im_func = None 71 else: 86 elif callable(callback): 87 # What the heck is it? well... its supposed to be callable... 72 88 self.im_func = callback 73 89
