Skip to content
  • Nicolas Gattolin's avatar
    [cmso] fixed a code smell (py3 port) · 299a4dc1
    Nicolas Gattolin authored and Romain Bignon's avatar Romain Bignon committed
    The lines "keys = ..." and "contacts = ..." execute in py2 but not in py3.
    Reason is: this code relies (not on pupose I think) on a feature
    that is implementation-specific (CPython 2.X): the leak of for loop
    iteration variables in local scope, thus permitting use of those variables after loop finished.
    
    In addition, the first line initializes a variable that shadows an
    existing non-local variable.
    
    This code magically worked for 2 years. But as Python3.X removes this
    specificity, this code is no longer valid.
    
    Blind fixes used:
    - replace keys local variable with keys_
    - change order of loop nesting to have fonctionnaly equivalent but
    functional code
    299a4dc1