frostyx / copr / copr

Forked from copr/copr 7 years ago
Clone

fc64a1a python: Don't apply bind_proxy in BaseProxy __init__()

10 files Authored by csomh 3 years ago, Committed by praiskup 3 years ago,
    python: Don't apply bind_proxy in BaseProxy __init__()
    
    Applying the 'bind_proxy' decorator in the __init__() of BaseProxy on
    every method of the class was done to save some effort in repeating a
    class decorator.
    
    This approach though results in the 'bind_proxy' decorator being applied
    every time a proxy object is constructed, which, if enough objects are
    constructed, leads to a RecursionError when the stack of 'bind_proxy'
    decorators becomes higher than the maximum recursion depth of the Python
    interpreter.
    
    Make 'for_all_methods' a class decorator and use it decorate all the
    '*Proxy' classes, instead of calling it in BaseProxy.__init__().
    
    Fixes: #1499.
    
    Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
    
        
file modified
+7 -4