Ticket #6857: robustapply_pypy_compatible.patch

File robustapply_pypy_compatible.patch, 1.3 KB (added by anto.cuni@…, 16 years ago)
  • django/dispatch/robustapply.py

     
    1414    If fromMethod is true, then the callable already
    1515    has its first argument bound
    1616    """
    17     if hasattr(receiver, '__call__'):
    18         # receiver is a class instance; assume it is callable.
    19         # Reassign receiver to the actual method that will be called.
    20         if hasattr( receiver.__call__, 'im_func') or hasattr( receiver.__call__, 'im_code'):
    21             receiver = receiver.__call__
    22     if hasattr( receiver, 'im_func' ):
    23         # an instance-method...
     17    if hasattr(receiver, 'im_func'):
    2418        return receiver, receiver.im_func.func_code, 1
    25     elif not hasattr( receiver, 'func_code'):
     19    elif hasattr(receiver, 'func_code'):
     20        return receiver, receiver.func_code, 0
     21    elif hasattr(receiver, '__call__'):
     22        return function(receiver.__call__)
     23    else:
    2624        raise ValueError('unknown reciever type %s %s'%(receiver, type(receiver)))
    27     return receiver, receiver.func_code, 0
    2825
    2926def robustApply(receiver, *arguments, **named):
    3027    """Call receiver with arguments and an appropriate subset of named
Back to Top