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

compile.c

Blame
    • Damien George's avatar
      dd5353a4
      py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts. · dd5353a4
      Damien George authored
      MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
      which is useful when only loading of pre-compiled bytecode is supported.
      It is enabled by default.
      
      MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
      functions.  By default they are only included if MICROPY_ENABLE_COMPILER
      is enabled.
      
      Disabling both options saves about 40k of code size on 32-bit x86.
      dd5353a4
      History
      py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts.
      Damien George authored
      MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
      which is useful when only loading of pre-compiled bytecode is supported.
      It is enabled by default.
      
      MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
      functions.  By default they are only included if MICROPY_ENABLE_COMPILER
      is enabled.
      
      Disabling both options saves about 40k of code size on 32-bit x86.
    gen_yield_from_throw2.py NaN GiB
    # generator ignores a thrown GeneratorExit (this is allowed)
    
    def gen():
        try:
            yield 123
        except GeneratorExit:
            print('GeneratorExit')
        yield 456
            
    # thrown a class
    g = gen()
    print(next(g))
    print(g.throw(GeneratorExit))
    
    # thrown an instance
    g = gen()
    print(next(g))
    print(g.throw(GeneratorExit()))