Skip to content
  • Damien George's avatar
    py/builtinimport: Remove unreachable code for relative imports. · 2f7fad66
    Damien George authored
    The while-loop that calls chop_component will guarantee that level==-1 at
    the end of the loop.  Hence the code following it is unnecessary.
    
    The check for p==this_name will catch imports that are beyond the
    top-level, and also covers the case of new_mod_q==MP_QSTR_ (equivalent to
    new_mod_l==0) so that check is removed.
    
    There is also a new check at the start for level>=0 to guard against
    __import__ being called with bad level values.
    2f7fad66