Changeset 163

Show
Ignore:
Timestamp:
05/23/02 12:41:20 (7 years ago)
Author:
sholloway
Message:

Fixed bug in BindCallable? for builtin methods and functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/WeakBind.py

    r161 r163  
    4242#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    4343 
    44 typesMethods = (types.MethodType, types.UnboundMethodType
     44typesMethods = (types.MethodType, types.UnboundMethodType, types.BuiltinFunctionType, types.BuiltinMethodType
    4545typesInstances = (object, types.InstanceType) 
    4646typesRequireBinding = typesMethods + typesInstances 
     
    7777        elif isinstance(callback, typesMethods): 
    7878            # Wrap up the method and potential instance 
    79             if callback.im_self is not None:  
     79            if getattr(callback, 'im_self', None) is not None:  
    8080                self.im_self = weakref.ref(callback.im_self) 
    81             self.im_func = callback.im_func 
     81            self.im_func = getattr(callback, 'im_func', callback) 
    8282        elif isinstance(callback, typesInstances): 
    8383            # This is a "callable object", make a weakref to it