Skip to content
Snippets Groups Projects
Select Git revision
  • dualcore
  • ch3/leds
  • wip-bootstrap default
  • ch3/time
  • master
5 results

builtinimport.c

Blame
    • Damien George's avatar
      2f7fad66
      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
      History
      py/builtinimport: Remove unreachable code for relative imports.
      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.