Attempt to obtain the real function object that might be wrapping ``obj``, while at the same time returning a bound method to ``holder`` if the original object was a bound method.
(obj, holder)
| 294 | |
| 295 | |
| 296 | def get_real_method(obj, holder): |
| 297 | """Attempt to obtain the real function object that might be wrapping |
| 298 | ``obj``, while at the same time returning a bound method to ``holder`` if |
| 299 | the original object was a bound method.""" |
| 300 | try: |
| 301 | is_method = hasattr(obj, "__func__") |
| 302 | obj = get_real_func(obj) |
| 303 | except Exception: # pragma: no cover |
| 304 | return obj |
| 305 | if is_method and hasattr(obj, "__get__") and callable(obj.__get__): |
| 306 | obj = obj.__get__(holder) |
| 307 | return obj |
| 308 | |
| 309 | |
| 310 | def getimfunc(func): |
no test coverage detected