Merge pull request #14560 from Nuullll/condfunc-warning
Handle CondFunc exception when resolving attributes
This commit is contained in:
commit
30aa5e0a7c
|
@ -11,10 +11,14 @@ class CondFunc:
|
|||
break
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
for attr_name in func_path[i:-1]:
|
||||
resolved_obj = getattr(resolved_obj, attr_name)
|
||||
orig_func = getattr(resolved_obj, func_path[-1])
|
||||
setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs))
|
||||
except AttributeError:
|
||||
print(f"Warning: Failed to resolve {orig_func} for CondFunc hijack")
|
||||
pass
|
||||
self.__init__(orig_func, sub_func, cond_func)
|
||||
return lambda *args, **kwargs: self(*args, **kwargs)
|
||||
def __init__(self, orig_func, sub_func, cond_func):
|
||||
|
|
Loading…
Reference in New Issue